PHP Forms

liunx

Guest
Hi, i have just started to learn PHP. I have got to the bit about forms and it tells me to put <form action="myfile.php blablabla>

and then in myfile.php put:
<?php
print "Welcome <b>$user</b><P>\n\n";
print "Your address is:<P>\n\n<b>$address</b>";
?>

in the body of myfile.php

All this works fine. But, how to you specify the email address the information submitted should be sent to?

Thanks
Jamie
<!-- m --><a class="postlink" href="http://www.warleyscouts.org.uk">http://www.warleyscouts.org.uk</a><!-- m -->
<!-- m --><a class="postlink" href="http://www.warleyscouts.org.uk/redazzai">http://www.warleyscouts.org.uk/redazzai</a><!-- m --> havent seen it done like that before?, here try this:

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

mail( "[email protected]", "Fomr results",
$message, "From: $email" );
header( "Location: <!-- m --><a class="postlink" href="http://www.example.com/thankyou.html">http://www.example.com/thankyou.html</a><!-- m -->" );
?>


you can remove the header line which just redirects to a thankyou/confirmation page

:)try not to use $_REQUEST. that is the daddy of POST, GET, FILES, COOKIE

just use $_POST if you cancheers scoutt, i'm changing a form at the mo so i'll try and remove any $_requests :)

/added

god yes, i completely didnt realise that request will use any input mechanism it can :eek:
 
Back
Top