Dynadot — .com Registration $8.99

Problem with PHP

Spaceship Spaceship
Watch

monRa

VIP Member
Impact
23
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> </p>
  <p> </p>
  <p> </p>
  <p> </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:
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 protected]";
$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
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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';
 
0
•••
monRa:

I see two errors:

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

This line:
PHP:
$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:
mail ($recipient, $subject, $msg);

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:
mail($recipient, $subject, $msg);

Happy coding.

-Bob
 
0
•••
also, hopefully ur host supports php mail() function because some hosts are evil and dont lol
 
0
•••
I change it all but still not working, i will change host, i use atspace.com at the moment
 
0
•••
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?
 
0
•••
Complete fine and no getting the mail but let me change host and if still not working will post here ;) thanks anyway
 
0
•••
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 .= "[email protected]";
$subject = "From dnValley";
mail($recipient, $subject, $msg);

?>
</body>
</html>
index.htm
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> </p>
  <p> </p>
  <p> </p>
  <p> </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
 
0
•••
replace $POST['email'] using $_POST['email']
 
0
•••
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 ;(
 
0
•••
Try this for submit.php I aslo added to where the email is checked for validation. :)

PHP:
<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..
$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);

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 = "[email protected]";
$subject = "From dnValley";

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

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

E-mail address:

$e

Domains:

$msg

", $headers);

?>
</body>
</html>
 
1
•••
all seems fine sv.

as for why it's not working, check if mail is supported at ur second host too
 
0
•••
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
 
0
•••
good luck, notify me if you need to run a test on my own machine
 
1
•••
notify me if you need to run a test on my own machine
sure, if that's free?
a pm on the way
 
0
•••
testing done, monra happy:)
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back