php help
Posted by: tolu93 (41.77.170.---)
Date: July 19, 2012 01:13PM

pls i need help on my php am new to the language this is my code:
<?php
if(isset($_POST['Send']))
{
$submit = $_POST['Send'];
}
$username = $_POST['Name'];
$phone_number = $_POST['Phone number'];
$country = $_POST['Location'];
$comment = $_POST['Message'];
$email = $_POST['Email'];

$to = "tolu58@gmail.com";
$subject = 'Test';
$from_user = $email;
//$headers = "From: $from\r\nBcc: $bcc\r\n";

$headers = "MIME-Version: 1.0"."\r\n".
"Content-type: text/html; charset=UTF-8" . "\r\n".
"X-Priority: 3\r\n".
"From: $from_user <Tolulope>\r\n".
"Reply-To: 'tolu58@gmail.com'\r\n".
"X-Mailer: smail-PHP ".phpversion()."\r\n";
$sent=mail($to, $subject, $from_user, $headers);
?>
i get an undefined index error for msg and phone number also its not connecting to my server am using wampserver php5.30.
thanks in anticipation

Options: ReplyQuote
Re: php help
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: July 19, 2012 02:02PM

This is not a PHP help site.... but,

Remember that the php code will run when the page is first loaded ( when no data has been entered ) as well as when the user presses the SEND button.


All the code you have here is only relevant to run when the user presses the SEND button, so move it all inside your first IF statement.

Options: ReplyQuote
Re: php help
Posted by: tolu93 (41.77.170.---)
Date: July 19, 2012 04:24PM

thanks for that but y is my wampserver giving me the function mail error i.e to either check my SMTP and smtp_port its version 2.0



Edited 1 time(s). Last edit at 07/19/2012 04:33PM by tolu93.

Options: ReplyQuote
Re: php help
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: July 19, 2012 04:46PM

mail() does not work on windows as windows does not have a built in mail server

I use hMailer, its a windows mail server but its not simple.

The other option is to use something like phpMailer
[www.askapache.com]

and use your yahoo/gmail/??? server to do the smtp ( sending ) part.

Options: ReplyQuote


Sorry, only registered users may post in this forum.