cwissick Posted July 17, 2008 Share Posted July 17, 2008 I'm new to creating web forms and I know this is not the best attempt at my first form, but I was hoping someone could help me. All I want is to be able to set this up and have the form emailed back with the content. Unfortunately, it's all working except that the email sent to me (dbigsby1 account listed) is blank. Could someone please help me and correct this form or show me how? Thank you for any and all help! It's greatly appreciated! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Don's Olympic Notes</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; background-color: #999999; } a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } body,td,th { color: #000000; } .style1 {color: #EBEBEB} .style6 { font-family: Arial, Helvetica, sans-serif; font-size: 12px; } .style7 {font-family: Arial, Helvetica, sans-serif} --> </style> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> </head> <body> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F9F9F9"> <tr> <td colspan="11" class="style1"><div align="center"><img src="Header.png" width="800" height="120" /></div></td> </tr> <tr> <td width="594" align="center" valign="top" bgcolor="#EBEBEB" class="style1"><div align="left"> <form id="form1" name="form1" method="post" action="contactform.php"> <table width="130%" border="0"> <tr> <td colspan="2" class="style6"><img src="orderform.png" width="600" height="25" /></td> </tr> <tr> <td width="26%" class="style6"><div align="right" class="style7"> <label for="name">Name:</label> </div></td> <td width="74%" class="style6"><div align="left" class="style7"> <input name="name" type="text" id="name" size="35" maxlength="90" /> </div></td> </tr> <tr> <td class="style6"><div align="right" class="style7"> <label for="address">Address:</label> </div></td> <td class="style6"><div align="left" class="style7"> <textarea name="address" id="address" cols="34" rows="4"></textarea> </div></td> </tr> <tr> <td class="style6"><div align="right" class="style7"> <label for="phone">Phone:</label> </div></td> <td class="style6"><div align="left" class="style7"> <input name="phone" type="text" id="phone" size="35" maxlength="15" /> </div></td> </tr> <tr> <td class="style6"><div align="right" class="style7"> <label for="email">Email:</label> </div></td> <td class="style6"><div align="left" class="style7"> <input name="email" type="text" id="email" size="35" maxlength="60" /> </div></td> </tr> <tr> <td class="style6"><div align="right"><span class="style7"></span></div></td> <td class="style6"><div align="left"><span class="style7"></span></div></td> </tr> <tr> <td height="52" class="style6"><div align="right"><span class="style7"></span></div></td> <td class="style6"><div align="left" class="style7"> <p>Each individual pin is $3.00 (US). <br> Both pins purchased together is $5.00 (US).<br> Price includes shipping charges.</p> <p>If you are interested in quantities of ten or more of the same item, please email Don Bigsby at <a href="mailto:[email protected]">[email protected]</a>.</p> </div></td> </tr> <tr> <td class="style6"><div align="right" class="style7"> <label for="image1"></label> </div></td> <td class="style6"> <div align="center" class="style7"> <div align="left"> <input type="image" name="imageField" id="imageField" src="images/usarings.JPG" /> </div> </div></td> </tr> <tr> <td class="style6"><div align="right" class="style7"> <label for="quantity"></label> <label for="select"></label> <label for="quantity">Quantity:</label> </div></td> <td class="style6"><div align="left" class="style7"> <input name="quantity" type="text" id="quantity" size="4" maxlength="4" /> </div></td> </tr> <tr> <td class="style6"><div align="right"><span class="style7"></span></div></td> <td class="style6"><div align="left"><span class="style7"></span> <label for="usaflag"></label> <input type="image" name="usaflag" id="usaflag" src="images/usaflag.JPG" /> </div></td> </tr> <tr> <td class="style6"><div align="right"><span class="style7"></span> <label for="quantity2">Quantity:</label> </div></td> <td class="style6"><div align="left"><span class="style7"></span> <input name="quantity2" type="text" id="quantity2" size="4" maxlength="4" /> </div></td> </tr> <tr> <td class="style6"> </td> <td class="style6">After hitting submit, you will be sent a confirmation email with your purchase total.</td> </tr> <tr> <td class="style6"><div align="right"><span class="style7"></span> <label for="clear"></label> <input type="reset" name="clear" id="clear" value="Clear Form" /> </div></td> <td class="style6"><div align="left"><span class="style7"></span> <label for="submit"></label> <div align="left"> <input type="submit" name="submit" id="submit" value="Submit" /> </div> </div></td> </tr> <tr> <td class="style6"><div align="right"><span class="style7"></span></div></td> <td class="style6"><div align="left"><span class="style7"></span></div></td> </tr> </table> </form> </div></td> </tr> </table> <div align="right"></div> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F9F9F9"> <tr> <td width="598" height="23" align="left" valign="top" bgcolor="#EBEBEB" class="style6"> <blockquote> </blockquote> </td> <td width="202" colspan="10" align="right" valign="top" bgcolor="#EBEBEB" class="style1"> </td> </tr> </table> <table width="800" border="1" align="center" bgcolor="#F9F9F9"> </table> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/115287-php-not-working/ Share on other sites More sharing options...
Skittalz Posted July 17, 2008 Share Posted July 17, 2008 this is all the html and css... can you please display your php file that handles the form as well? thanks Steve Quote Link to comment https://forums.phpfreaks.com/topic/115287-php-not-working/#findComment-592725 Share on other sites More sharing options...
cwissick Posted July 17, 2008 Author Share Posted July 17, 2008 Sorry I thought I had pasted that! <?php //Subject and Email Variables // $emailSubject = 'Order Received!'; $webMaster = '[email protected]'; //Gathering Data Variables // $nameField = $_POST['name']; $addressField = $_POST['address']; $phoneField = $_POST['phone']; $emailField = $_POST['email']; $quantityField = $_POST['quantity']; $quantity2Field = $_POST['quantity']; $body = <<<EOD -------------------------------------------------------------------------------- Name: $name Address: $address Phone: $phone Email: $email Quantity Rings: $quantity Quantity Flags: $quantity2 EOD; $headers = "From; $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail ($webMaster, $emailSubject, $body, $headers); // Results rendered as html// $theResults = <<<EOD <html> <head> <title> Don's Olympic Notes</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <style type="text/css"> <!-- body { background-color: #F9F9F9; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } .style1 { color: #000000; font-family: Arial, Helvetica, sans-serif; } body,td,th { color: #000000; } --> </style> </head> <div> <div align="left" class="style1">Thank you for your interest! Your email will be answered shortly!</div> </div> </body> </html> EOD; echo $theResults; if($variable=="") { //error }else { //redirect to thank you page } ?> Quote Link to comment https://forums.phpfreaks.com/topic/115287-php-not-working/#findComment-592733 Share on other sites More sharing options...
Skittalz Posted July 17, 2008 Share Posted July 17, 2008 I'm confused.. what is below the line and where does the php end -------------------------------------------------------------------------------- Quote Link to comment https://forums.phpfreaks.com/topic/115287-php-not-working/#findComment-592742 Share on other sites More sharing options...
cwissick Posted July 17, 2008 Author Share Posted July 17, 2008 Below the line are the variables I want people to be able to fill out so that the information in the form is sent to my email account. Quote Link to comment https://forums.phpfreaks.com/topic/115287-php-not-working/#findComment-592784 Share on other sites More sharing options...
compguru910 Posted July 17, 2008 Share Posted July 17, 2008 If your new to coding in PHP, I would recommend staying away from MIME mail for a while, and stick with the regular mail() function until you get the hang of coding. You code doesnt seem to be structured very well either. Just a heads up. If you need some tips on how to do the regular mail(), let me know. Be glad to help Quote Link to comment https://forums.phpfreaks.com/topic/115287-php-not-working/#findComment-592801 Share on other sites More sharing options...
cwissick Posted July 18, 2008 Author Share Posted July 18, 2008 Yeah like I said I'm really not sure what I'm doing and I just need to do this one form. I would greatly appreciate it if I could just get it to do the regular mail function, as I'm not sure what the difference is anyway! Let me know where I should start. Thank you compguru! Quote Link to comment https://forums.phpfreaks.com/topic/115287-php-not-working/#findComment-592979 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.