NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Problem with PHP

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 09-02-2005, 07:43 AM THREAD STARTER               #1 (permalink)
Senior Member
Join Date: Nov 2004
Location: Greece
Posts: 2,198
monRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to behold
 



Problem with PHP


i wanna create a website that someone add domains and e-mail and then i send him appraisal so i created this code:
this is index.htm page
Code:
<html>
<head>
<title>dnValley</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<div align="center">
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p><a href="index.htm"><img src="logito.gif" width="350" height="77" alt="dnValley" border="0"></a> 
  </p>
  <p> 

<FORM action="submit.php" method="POST">
    <textarea name="domains" cols="50" rows="5">Add here the domain names, the domain names must be yours, we don't have time doing appraisals for domains just for your fun. Please don't add more than 25 domains in this text box and per day.</textarea>
    <br>
    <input type="text" name="email" value="Insert here your e-mail here" size="30">
  <p></p>
  <p> 
    <input type="submit" name="Submit" value="Do the appraisals...">
</FORM>
 
 <p></p>
</div>
</body>
</html>
and the submit.php is this:
????: NamePros.com http://www.namepros.com/programming/120454-problem-with-php.html
Code:
<html>
<head>
<title>dnValley</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">



<div align="center"><br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <img src="submitting.gif" width="416" height="91"> 
</div>
<?php

$msg .= "Domain Names: $_POST[domains]\n";
$msg .= "E-mail: $POST[email]\n";
$recipient .= "email@gmail.com";
$subject = "From dnValley";
mail ($recipient, $subject, $msg);

?>
</body>
</html>
the problem is i uploaded and tried but doesn't work, i don't got any mail
you can see it here: www.dnvalley.com
monRa is offline  
Old 09-02-2005, 10:06 AM   #2 (permalink)
Account Closed
Join Date: Jul 2005
Posts: 176
cbr600 is on a distinguished road
 



I'm not sure but try adding tick marks (') to the $_POST array variables
Code:
$msg .= "Domain Names: $_POST['domains']\n";
$msg .= "E-mail: $POST['email']\n";
or try taking the $_POST out of the quote marks, that has given me problems before

Code:
$msg .= 'Domain Names: ' . $_POST['domains'] . '\n';
$msg .= 'E-mail: ' . $POST['email'] . '\n';
cbr600 is offline  
Old 09-02-2005, 11:04 AM   #3 (permalink)
NamePros Regular
 
moondog's Avatar
Join Date: Jun 2004
Posts: 587
moondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to all
 



monRa:

I see two errors:

PHP Code:
$msg .= "Domain Names: $_POST[domains]\n";
$msg .= "E-mail: $POST[email]\n";
$recipient .= "email@gmail.com";
$subject "From dnValley";
mail ($recipient$subject$msg); 
This line:
PHP Code:
$msg .= "E-mail: $POST[email]\n"
Will not properly append the email address to the $msg variable. You forgot the "_" in $_POST.

The second error that I see is:

PHP Code:
mail ($recipient$subject$msg); 
????: NamePros.com http://www.namepros.com/showthread.php?t=120454
You have a space between mail and the opening "(". PHP does not like this. Try removing the space and I think it will work:

PHP Code:
mail($recipient$subject$msg); 
????: NamePros.com http://www.namepros.com/showthread.php?t=120454
Happy coding.

-Bob
__________________
Can't wait to be out of this forsaken business. Getting close! :)
moondog is offline  
Old 09-02-2005, 11:18 AM   #4 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of
 



also, hopefully ur host supports php mail() function because some hosts are evil and dont lol
nasaboy007 is offline  
Old 09-02-2005, 11:52 AM THREAD STARTER               #5 (permalink)
Senior Member
Join Date: Nov 2004
Location: Greece
Posts: 2,198
monRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to behold
 



I change it all but still not working, i will change host, i use atspace.com at the moment
monRa is offline  
Old 09-02-2005, 12:25 PM   #6 (permalink)
NamePros Regular
Join Date: Aug 2005
Posts: 214
slantednet is on a distinguished road
 



Post your current code after the changes, so we can see where you stand now. Also, are you getting any error messages, or is it all completing fine and just not getting the email?
__________________
OnlineGames.net
slantednet is offline  
Old 09-03-2005, 01:18 AM THREAD STARTER               #7 (permalink)
Senior Member
Join Date: Nov 2004
Location: Greece
Posts: 2,198
monRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to behold
 



Complete fine and no getting the mail but let me change host and if still not working will post here thanks anyway
monRa is offline  
Old 09-10-2005, 01:58 AM THREAD STARTER               #8 (permalink)
Senior Member
Join Date: Nov 2004
Location: Greece
Posts: 2,198
monRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to behold
 



ok I moved to a new host but nothing happens again, i don't egt an mail.
Here is the code(with the changes done with your help):
submit.php
Code:
<html>
<head>
<title>dnValley</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">



<div align="center"><br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <img src="submitting.gif" width="416" height="91"> 
</div>
<?php
$msg .= 'Domain Names: ' . $_POST['domains'] . '\n';
$msg .= 'E-mail: ' . $POST['email'] . '\n';
$recipient .= "dnvalley@gmail.com";
$subject = "From dnValley";
mail($recipient, $subject, $msg);

?>
</body>
</html>
index.htm
????: NamePros.com http://www.namepros.com/showthread.php?t=120454
Code:
<html>
<head>
<title>dnValley</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<div align="center">
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p><a href="index.htm"><img src="logito.gif" width="350" height="77" alt="dnValley" border="0"></a> 
  </p>
  <p> 

<FORM action="submit.php" method="POST">
    <textarea name="domains" cols="50" rows="5">Add here the domain names, the domain names must be yours, we don't have time doing appraisals for domains just for your fun. Please don't add more than 25 domains in this text box and per day.</textarea>
    <br>
    <input type="text" name="email" value="Insert here your e-mail here" size="30">
  <p></p>
  <p> 
    <input type="submit" name="Submit" value="Do the appraisals...">
</FORM>
 
 <p></p>
</div>
</body>
</html>
thanks
monRa is offline  
Old 09-10-2005, 02:52 AM   #9 (permalink)
Senior Member
 
legend2's Avatar
Join Date: Sep 2005
Posts: 1,112
legend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud of
 



replace $POST['email'] using $_POST['email']
legend2 is offline  
Old 09-10-2005, 03:04 AM THREAD STARTER               #10 (permalink)
Senior Member
Join Date: Nov 2004
Location: Greece
Posts: 2,198
monRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to behold
 



Quote:
replace $POST['email'] using $_POST['email']
oops they have told me that but i forgot to do ;(
will do now

Chanegd but still got now mail ;(
monRa is offline  
Old 09-10-2005, 04:07 AM   #11 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Try this for submit.php I aslo added to where the email is checked for validation.

PHP Code:
<html>
<head>
<title>dnValley</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<div align="center"><br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <img src="submitting.gif" width="416" height="91">
</div>
<?php

//Grab the domains and email address..
????: NamePros.com http://www.namepros.com/showthread.php?t=120454
$domains $_POST['domains'];
$email $_POST['email'];

//Check to see if email is valid
$validate eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$"$email);
????: NamePros.com http://www.namepros.com/showthread.php?t=120454

if (!
$validate)
{
   
//The email is not valid..
   
echo($email " is NOT a valid email.");

}
//Ok, the email is valid :)
else

{

$e $email;

}

$message stripslashes($domains);
$recipient "dnvalley@gmail.com";
$subject "From dnValley";

$headers 'From: '.$e.'';

//Send the email...
mail("$recipient""$subject","

E-mail address:

$e

Domains:

$msg

"
$headers);

?>
</body>
</html>
Eric is offline  
Old 09-10-2005, 04:50 AM   #12 (permalink)
Senior Member
 
legend2's Avatar
Join Date: Sep 2005
Posts: 1,112
legend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud of
 



all seems fine sv.

as for why it's not working, check if mail is supported at ur second host too
legend2 is offline  
Old 09-10-2005, 05:50 AM THREAD STARTER               #13 (permalink)
Senior Member
Join Date: Nov 2004
Location: Greece
Posts: 2,198
monRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to behold
 



I found the problem, thanks for your code SecondVersion, i tried your code but still didn't worked so i thought of another problem, expect i have changed host and nameservers i was still hosted at atspace ;(
I know deleted my account at atspace(free one) but seems there is aproblem in ahost i have bought from a member at these forums ;(
Will post for other news, sorry i didn't know my domain hasn't moved host as the nameservers was changed time ago
monRa is offline  
Old 09-10-2005, 07:03 AM   #14 (permalink)
Senior Member
 
legend2's Avatar
Join Date: Sep 2005
Posts: 1,112
legend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud of
 



good luck, notify me if you need to run a test on my own machine
legend2 is offline  
Old 09-10-2005, 09:30 AM THREAD STARTER               #15 (permalink)
Senior Member
Join Date: Nov 2004
Location: Greece
Posts: 2,198
monRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to beholdmonRa is a splendid one to behold
 



Quote:
notify me if you need to run a test on my own machine
sure, if that's free?
a pm on the way
monRa is offline  
Old 09-12-2005, 05:28 AM   #16 (permalink)
Senior Member
 
legend2's Avatar
Join Date: Sep 2005
Posts: 1,112
legend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud oflegend2 has much to be proud of
 



testing done, monra happy
legend2 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: Getting started with PHP (The Basics) deadserious Webmaster Tutorials 60 11-17-2007 12:35 PM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 10:09 AM
PHP form problem mikeboy99 Programming 1 06-16-2004 08:07 AM
Problem with PHP and preloading images? crEA-tEch Programming 3 08-05-2003 12:05 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 01:15 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger