hi guys please i need help with my php form . here is the html <html> <head><title>test1</title></head> <body> <form action="next2.php" method="post"> Name: <input type="text" name="name"> Email: <input type="text" name="email"> Mail: <input type="textarea" row="7" cols="70"name="message"> <input type="submit"value="send your message" > </form> </body> </html> HTML: here is the php <?php $name=$_POST['name']; $email=$_POST['email']; $mail=$_POST['message']; Name:$name\n Email:$email\n Message:$mail\n //to, message, header mail('me@myemail.com',"$mail",'From:'. $name.'<'.$email.'>'); header('location: http://www.mywebsite') ?> PHP: please what am i doing wrong here .
What error are you receiving? We should start by finding out what you are looking to resolve. Thanks!
your code has a few errors: <?php $name=$_POST['name']; $email=$_POST['email']; $mail=$_POST['message']; /**** either needs to be commented out or echo'd ****/ echo "Name:$name\n"; echo "Email:$email\n"; echo "Message:$mail\n"; //to, message, header mail('me@myemail.com',"$mail",'From:'. $name.'<'.$email.'>'); header('location: http://www.mywebsite');// forgot the semi colon ; ?> PHP: That's all I see at the moment
Your code wont work either.. You can not modify header once the output started. So you can not echo anything (even a white space) if you want to modify your header somewhere later in the script. This should work: <?php $name = $_POST['name']; $email = $_POST['email']; $mail = $_POST['message']; //to, message, header mail('me@myemail.com',"$mail",'From:'. $name.'<'.$email.'>'); header('location: http://www.mywebsite'); ?> PHP: