Jump to content

Help With PhP Form


blacksun

Recommended Posts

I'm relatively new at Php actually I just started reading it's code this week but I am experience in other languages also anyway I'm having problems with this code I have written.

 

Basically I want my viewers to post me form messages on my website to my email.

 

So after I did my 5th test I still haven't received any of my post that I submitted in each test to my email inbox & I don't know what I'm doing wrong to not have this happen, maybe you can help?

 

<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;

mail( "htp://[email protected]", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.google.com" );
?>

Link to comment
https://forums.phpfreaks.com/topic/142562-help-with-php-form/
Share on other sites

<?php 
if ($_POST["email"]<>'') { 
$ToEmail = '[email protected]'; 
$EmailSubject = 'Site contact form '; 
$mailheader = "From: ".$_POST["email"]."\r\n"; 
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; 
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; 
        $MESSAGE_BODY .= "Message: ".$_POST["message"]."<br>"; 
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); 
?> 
Your message to [email protected] was successfully sent!
<?php 
} else { 
?> 
<form action="form.php" method="post"> //change "form.php" to any other name you wish
<table width="400" border="0" cellspacing="2" cellpadding="0">
<tr>
<td class="bodytext">Email:</td>
<td><input name="email" type="text" id="email" size="32"></td>
</tr>
<tr>
<td class="bodytext">Message:</td>
<td><textarea name="messsage" cols="45" rows="6" id="message" class="bodytext"></textarea></td>
</tr>
<tr>
<td class="bodytext"> </td>
<td align="left" valign="top"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form> 
<?php 
}; 
?>

 

I believe that ^ works.

Link to comment
https://forums.phpfreaks.com/topic/142562-help-with-php-form/#findComment-747116
Share on other sites

Your problem is that "htp://[email protected]" is not valid email address.

 

After reading another persons post on here I was thinking maybe that might be the problem. I put in my hotmail.com address but am willing to change my email address to fix this problem.

 

Is there other free email host that I can register with so the form can be sent to without the problem, maybe something you guys use?

Link to comment
https://forums.phpfreaks.com/topic/142562-help-with-php-form/#findComment-747125
Share on other sites

Your problem is that "htp://[email protected]" is not valid email address.

 

After reading another persons post on here I was thinking maybe that might be the problem. I put in my hotmail.com address but am willing to change my email address to fix this problem.

 

Is there other free email host that I can register with so the form can be sent to without the problem, maybe something you guys use?

 

Did you try it without the http:// in front of the email address?

Link to comment
https://forums.phpfreaks.com/topic/142562-help-with-php-form/#findComment-747126
Share on other sites

Your problem is that "htp://[email protected]" is not valid email address.

 

You were right the problem is with the url writing of it. Once I took out the http:// it worked. So now it's sending me messages. Thanks well done Crayon Violent.

 

When I write in the email it sends to me what was written in the email box but unfortunatly not what was written in the message box. I wish I could talk some more but I have to go out I'll check out tomorrows responses on here thanks again for the help.

 

It's going to take me a little time figuring out aznkidzx script specially what all those $mailheader's do so I can write more to the program such as name, address & such.

Link to comment
https://forums.phpfreaks.com/topic/142562-help-with-php-form/#findComment-747135
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.