jmanley0704 Posted June 21, 2011 Share Posted June 21, 2011 I am not a scriptor at all I am trying to get my husband's painting website up and running on Godaddy webhosting. I have a form that is requesting some information it includes a Project section which has several checkboxes it allows potential customers to select what type of job(s) they have (ie, interior,exterior, decks, etc) So the problem is when I recieve the email from the form submission the only information I get back from the checkbox selections is "array" I know I need to modify the PHP Script to gather the checkbox info but I have no idea what how to write it and where to insert it in the code... I should mention that Godaddy makes you use their script its called GDForm.php The HTML and PHP code is below. If someone could help me I would be sooooo Grateful I am a Systems Adminstrator so this is really bugging me!!!! HTML <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>JKM Painting, LLC - serving southern NH</title> <link rel="stylesheet" href="styles.css" type="text/css"> </head> <body> <div id="headercontainer"> <div id="logo"></div> <div id="topphotos"></div> <div id="navbutton5"><a href="contact_jkm_painting.htm">Contact Us</a></div> <div id="navbutton4"><a href="jkm_painting_testimonials.htm">Testimonials</a></div> <div id="navbutton3"><a href="painting_portfolio.htm">Portfolio</a></div> <div id="navbutton2"><a href="jkm_painting_services.htm">Our Services</a></div> <div id="navbutton1"><a href="index.htm">About Us</a></div> </div> <div id="maincontainer"> <div id="copyservices"> <span class="home1stline">For a <span class="turq">FREE</span> estimate, call or send us an email today!</span><br> <span class="home2ndline">603.321.2644 / [email protected]</span><br> <img src="g/sp.gif" width="10" height="15"> <p class="subtitle">Contact Us</p> <p>Thank you for considering JKM Painting, LLC for your residential painting needs. Please complete the form below and Jonathan Manley (owner of JKM Painting, LLC) will contact you within 48 hours.</p> <form action="/gdform.php" method="post"> <input type="hidden" name="subject" value="Website Form Submission" /> <input type="hidden" name="redirect" value="contact_2.htm" /> <p><table border=0 width=495 cellspacing=0 cellpadding=1> <tr><td>Name:</td> <td><input name="realname" type="text" rows=1 size="37"></td></tr> <tr><td>Address:</td> <td><input name="address" type="text" rows=1 size="37"></td></tr> <tr><td>City / State / Zip:</td> <td><input name="city" type="text" rows=1 size="25"> <input name="state" type="text" rows=1 size="2"> <input name="zip" type="text" rows=1 size="10"> </td></tr> <tr><td>Home Phone:</td> <td><input name="HomePhone" type="text" rows=1 size="37"></td></tr> <tr><td>Work Phone:</td> <td><input name="WorkPhone" type="text" rows=1 size="37"></td></tr> <tr><td>Cell Phone:</td> <td><input name="CellPhone" type="text" rows=1 size="37"></td></tr> <tr><td>Email Address:</td> <td><input name="email" type="text" rows=1 size="37"></td></tr> <tr><td valign=top>Project<br> (check all that apply)</td> <td><input type="checkbox" name="Project[]" value="Exterior"> Exterior House Painting<br> <input type="checkbox" name="Project[]" value="Interior"> Interior<br> <input type="checkbox" name="Project[]" value="Deck"> Deck<br> <input type="checkbox" name="Project[]" value="PresWash"> Pressure Washing<br> <input type="checkbox" name="Project[]" value="Commercial "> Commercial Painting<br> </td></tr> <tr><td valign=top>Additional Comments:</td><td> <textarea name="Comments" rows=2 cols=40 wrap></textarea></td></tr> <tr><td></td><td align=center><input type="submit" name="submit" value="submit"/></form><p> </td></tr> <p> </div> </div> </body> </html> PHP <?php $request_method = $_SERVER["REQUEST_METHOD"]; if($request_method == "GET") { $query_vars = $_GET; } elseif ($request_method == "POST") { $query_vars = $_POST; } reset($query_vars); $t = date("U"); $file = $_SERVER['DOCUMENT_ROOT'] . "\ssfm\gdform_" . $t; $fp = fopen($file,"w"); while (list ($key, $val) = each ($query_vars)) { fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\r\n"); fputs($fp,"$val\r\n"); fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\r\n"); if ($key == "redirect") { $landing_page = $val; } } fclose($fp); if ($landing_page != "") { header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page"); } else { header("Location: http://".$_SERVER["HTTP_HOST"]."/"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/239997-need-help-with-a-form-not-a-experienced-with-php-please-help/ Share on other sites More sharing options...
AbraCadaver Posted June 21, 2011 Share Posted June 21, 2011 Since it's sweet that you're doing this for your husband, I'll try and help The problem is that Project is an array denoted by the [] in the form. Try changing this: while (list ($key, $val) = each ($query_vars)) { fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\r\n"); fputs($fp,"$val\r\n"); fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\r\n"); if ($key == "redirect") { $landing_page = $val; } } To this: while (list ($key, $val) = each ($query_vars)) { // begin inserted code if(is_array($val)) { $val = implode(', ', $val); } // end inserted code fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\r\n"); fputs($fp,"$val\r\n"); fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\r\n"); if ($key == "redirect") { $landing_page = $val; } } Quote Link to comment https://forums.phpfreaks.com/topic/239997-need-help-with-a-form-not-a-experienced-with-php-please-help/#findComment-1232820 Share on other sites More sharing options...
jmanley0704 Posted June 21, 2011 Author Share Posted June 21, 2011 You are my hero! Thanks so much!!!! Quote Link to comment https://forums.phpfreaks.com/topic/239997-need-help-with-a-form-not-a-experienced-with-php-please-help/#findComment-1232842 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.