imax Posted June 23, 2007 Share Posted June 23, 2007 Hi, I have put a sendmail script together but I am having problems with it. Any help would be appreciated. ok I have a simple form below is the code: <form action=script/sendmail.php method=post> <table border=0> <tr> <td>Name:</td><td><input type=text name=name size=40></td> </tr> <tr> <td> </td><td align=center><input type=submit name=submit value=Submit> <input type=reset Value=Reset></td> </tr> </table> </form> It's just a simple form to get me used to phps built in mail function. Ok I have made an input field and named it and actioned it to post to a sendmail script. Below is my sendmail script: <?php $name = $_GET['name']; $to = "[email protected]"; $subject = "My Website Test"; $message = "Name: \t $name \n"; mail($to, $subject, $message); echo "<html><head><title>My Site</title></head>"; echo "<body><p><font size=6>Thankyou,</font></p>"; echo "<p>Your Mail has been sent</p><p><a href=../index.html>Return</a></p>"; echo "</body></html>"; ?> As you can see it's nothing fancy and probably looks like most all other simple mail scripts. Problem is when this script E-mails me the info I get this below: Name: As you can see it puts in the Name: and a tab in but once it gets to the variable it's missing it. Everything else works I even inserted a php.ini in the same folder as my script regestering globals as on and different ways of writing the script within my scope. I have not been useing php for long and know the basics of what I am doing and this is basically one of my first scripts. Can someone please tell me where I went wrong as this is starting to drive me crazy. Link to comment https://forums.phpfreaks.com/topic/56881-form-problem/ Share on other sites More sharing options...
digitalgod Posted June 23, 2007 Share Posted June 23, 2007 your form is using the post method so just replace $_GET['name'] by $_POST['name'] Link to comment https://forums.phpfreaks.com/topic/56881-form-problem/#findComment-281036 Share on other sites More sharing options...
imax Posted June 23, 2007 Author Share Posted June 23, 2007 Thanks for putting me right DigitalGod. Worked like a dream Link to comment https://forums.phpfreaks.com/topic/56881-form-problem/#findComment-281093 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.