Hostlb
01-19-2010, 06:24 PM
Hello guys , hope everybody is okay .
I'm having a little problem with a php code
<? //enter recipient's email address. If multiple recipients, separate with comma:
$to="someemail@yourdomain.com";
if(isset($_POST['email'])){
if(ereg("^[^@]{1,64}@[^@]{1,200}\.[a-zA-Z]{2,3}$",$_POST['email'])){
mail($to,$_POST['subject'],$_POST['message'],"From: ".$_POST['email']);
echo'<font color="green">Your message was sent</font>';
}else echo'<font color="red">"'.$_POST['email'].'" is not a valid email address.</font>';
}
?><form action="" method="post"><table><tr><td>Your Email:</td><td><input name="email"></td></tr>
<tr><td>Subject:</td><td><input name="subject"></td></tr></table>Message:
<br><textarea rows="8" cols="50" name="message"></textarea><br>
<input type="submit" value="send"></form>
Okay, now to explain more on the issue , the code is working just fine as it now i'm trying to add more text areas & inputs like i want to add more information to be sent within the page like ex: Firstname , Lastname, Arrival Date , ect...
i've added them and prepared tables and everything but my biggest issue get related to $_POST
Check here .
mail($to,$_POST['subject'],$_POST['message'],"From: ".$_POST['email']);
Now in $_POST['message'] , it's working but when trying to add more inputs like ['L_name'] , or anything else the script stop working and messages never sent .
Any ideas how should i modify the code to fix it .
Best Regards
I'm having a little problem with a php code
<? //enter recipient's email address. If multiple recipients, separate with comma:
$to="someemail@yourdomain.com";
if(isset($_POST['email'])){
if(ereg("^[^@]{1,64}@[^@]{1,200}\.[a-zA-Z]{2,3}$",$_POST['email'])){
mail($to,$_POST['subject'],$_POST['message'],"From: ".$_POST['email']);
echo'<font color="green">Your message was sent</font>';
}else echo'<font color="red">"'.$_POST['email'].'" is not a valid email address.</font>';
}
?><form action="" method="post"><table><tr><td>Your Email:</td><td><input name="email"></td></tr>
<tr><td>Subject:</td><td><input name="subject"></td></tr></table>Message:
<br><textarea rows="8" cols="50" name="message"></textarea><br>
<input type="submit" value="send"></form>
Okay, now to explain more on the issue , the code is working just fine as it now i'm trying to add more text areas & inputs like i want to add more information to be sent within the page like ex: Firstname , Lastname, Arrival Date , ect...
i've added them and prepared tables and everything but my biggest issue get related to $_POST
Check here .
mail($to,$_POST['subject'],$_POST['message'],"From: ".$_POST['email']);
Now in $_POST['message'] , it's working but when trying to add more inputs like ['L_name'] , or anything else the script stop working and messages never sent .
Any ideas how should i modify the code to fix it .
Best Regards