wizard3 Posted August 24, 2007 Share Posted August 24, 2007 I just got my own website again and I need help running a PHP. I guess it would be a mailer, but I dont think its set up right. I'm using Dreamweaver and I have my table set up and ready to go. My problem is that I need help setting up the PHP so that when they hit the submit button, they get an echo of their order and its sent to me. I got the email just fine, but for some reason the test I sent out came into my email blank. Is there some command in Dreamweaver that I'm suppose to put with the order form that lets everything know its suppose to connect to the PHP? And I could really use the PHP code set up for me. I'm a totally idiot when it comes to PHP, so any one that helps.... you're going to have to explain it in layman's terms, not in geek. Cause PHP is not a geek speak I understand very well. Help please!! Quote Link to comment https://forums.phpfreaks.com/topic/66514-in-need-of-major-php-help/ Share on other sites More sharing options...
lemmin Posted August 24, 2007 Share Posted August 24, 2007 Please post some code that people can look at. Quote Link to comment https://forums.phpfreaks.com/topic/66514-in-need-of-major-php-help/#findComment-333077 Share on other sites More sharing options...
wizard3 Posted August 24, 2007 Author Share Posted August 24, 2007 Uhm.. okay. Well, this is the form code... <html> <head> <title>Tie Dye Order Form</title></head> <body> <form name="form1" method="post" action=""> <table width="50%" border="0"> <tr> <td width="18%">Name:</td> <td width="82%"><input name="name" type="text" id="name" size="30" maxlength="40"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Colors:</td> <td><textarea name="colors" cols="30" id="colors"></textarea></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Pattern:</td> <td><input name="patterns" type="text" id="patterns" size="30" maxlength="40"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Size:</td> <td><input type="text" name="textfield"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Method of Payment:</td> <td><input type="text" name="textfield2"> PayPal: were_cat3@hotmail.com</td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td height="21">Your Email:</td> <td><input name="textfield3" type="text" size="40"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Shipment address:</td> <td><textarea name="textarea" cols="50" rows="8"></textarea></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </form> </body> </html> And this is the code that I was given by my teacher a LONG while back... that I tried to modify... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Your copy</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php echo "<p>Name: $Name <br> Media: $Media <br> Colors: $Colors <br> Pattern: $Pattern <br> Size: $Size <br> Method of Payment: $Method <br> Email: $Email <br> Shipment: $Shipment"; $body="You have a new commission from $Name. \n $Colors \n $Pattern \n $Size \n $Method \n $Email \n $Shipment"; $to="blood_fire003@yahoo.com"; $subject="Tie-Dye!"; mail($to, $subject, $body); ?> </body> </html> I know something is probably wrong now though... Quote Link to comment https://forums.phpfreaks.com/topic/66514-in-need-of-major-php-help/#findComment-333083 Share on other sites More sharing options...
lemmin Posted August 24, 2007 Share Posted August 24, 2007 Those two snippets of code don't look like they are in the same file. Your form is directed to itself so the php file will never be run. Change action= in your form properties to the file that the php code is in. Quote Link to comment https://forums.phpfreaks.com/topic/66514-in-need-of-major-php-help/#findComment-333089 Share on other sites More sharing options...
wizard3 Posted August 24, 2007 Author Share Posted August 24, 2007 That doesnt help me. Like I said, you have to explain it to me in layman's terms. I dont know PHP... at ALL. You gotta tell me step by step and very simply what I'm suppose to do. Quote Link to comment https://forums.phpfreaks.com/topic/66514-in-need-of-major-php-help/#findComment-333090 Share on other sites More sharing options...
wizard3 Posted August 24, 2007 Author Share Posted August 24, 2007 Okay, figured it out. But the PHP still isnt working right. When it submits, its suppose to echo what was put into the form, and its not. Whats wrong? Quote Link to comment https://forums.phpfreaks.com/topic/66514-in-need-of-major-php-help/#findComment-333139 Share on other sites More sharing options...
AtomicNetwork Posted August 24, 2007 Share Posted August 24, 2007 Explore the $_POST[] variable, it is used to get information out of the HTTP Headers that have been transfered via a form. If you have a text field named "username", you would want to have something along the lines of $username = $_POST['username']; Quote Link to comment https://forums.phpfreaks.com/topic/66514-in-need-of-major-php-help/#findComment-333150 Share on other sites More sharing options...
MadTechie Posted August 24, 2007 Share Posted August 24, 2007 change <?php echo "<p>Name: $Name Media: $Media Colors: $Colors etc to <?php extract($_POST); //add this echo "<p>Name: $Name Media: $Media Colors: $Colors etc a bettet solution is to add $Name = $_POST['Name']; etc etc but in the script above extract will work Quote Link to comment https://forums.phpfreaks.com/topic/66514-in-need-of-major-php-help/#findComment-333159 Share on other sites More sharing options...
AtomicNetwork Posted August 24, 2007 Share Posted August 24, 2007 I would also advise securing all variables that are passed across pages as they are subject to manipulation, this is expecially important when you start adding the data to SQL, due to sql injection, cross stite scripting, etc. etc. A function to do exactly this is: function clean($string) { $string = stripslashes($string); $string = htmlentities($string); $string = strip_tags($string); return $string; } Then you have assign all of the variables by using: $username = clean($_POST[username]); Quote Link to comment https://forums.phpfreaks.com/topic/66514-in-need-of-major-php-help/#findComment-333175 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.