afterzero Posted October 20, 2008 Share Posted October 20, 2008 allo everyone i am having an issue...a client of mine uses a program to send out email blasts( web based) they have a contact form on their website with yes or no radio buttons to subscribe to their email list.... right now i have the form submitting to the email database no matter what happens just to get them rolling. what I am trying to accomplish is if the user selects yes...the form data is passed to the email companies proprietary script http://blahblahblahblah.com/multidouble.ice but if they select no, the form data gets emailed to a sales rep and no data is passed to the script. and ideas? here is some code: <form method="post" action="http://www.icebase.com/multidouble.ice"> <table cellspacing=0 cellpadding=4 border=0 class="bodytext" width="100%"> <tr> <td><strong>Would you like to be added to our mailing list?</strong></td> <td><input name="MailingList" type="radio" value="Yes"> Yes <input name="MailingList" type="radio" value="No"> No Thanks </td> </tr> <tr> <td></td> <td><input type="submit" value="Tell Me More!"> </td> </tr> </table> Thank you so so so much! justin Link to comment https://forums.phpfreaks.com/topic/129174-head-hits-wall-instead-of-a-simple-form/ Share on other sites More sharing options...
redarrow Posted October 20, 2008 Share Posted October 20, 2008 you need to use a switch there mate with header function......... Link to comment https://forums.phpfreaks.com/topic/129174-head-hits-wall-instead-of-a-simple-form/#findComment-669696 Share on other sites More sharing options...
afterzero Posted October 20, 2008 Author Share Posted October 20, 2008 so something like ( edited) $MailingList=$_POST['MailingList']; switch ($MailingList) { case "yes" header("Location: http://icebase.com/multidouble.ice " ); break; case "no" header("Location:thankyou.html" ); break; } ?> but would that actually send the form data to the multidouble.ice script? Link to comment https://forums.phpfreaks.com/topic/129174-head-hits-wall-instead-of-a-simple-form/#findComment-669697 Share on other sites More sharing options...
Bendude14 Posted October 20, 2008 Share Posted October 20, 2008 no it wouldn't send the form data to that page it would only redirect to that page. You can either have your form action set to that page and use POST or you could pass the data across in the URL and use GET to retrieve them. Link to comment https://forums.phpfreaks.com/topic/129174-head-hits-wall-instead-of-a-simple-form/#findComment-669707 Share on other sites More sharing options...
redarrow Posted October 20, 2008 Share Posted October 20, 2008 example working........ <?php if(isset($_POST['submit'])){ $MailingList=$_POST['MailingList']; if($MailingList=='Yes'){ header("location: http://www.google.com"); } if($MailingList=='No'){ header("location: http://www.msn.com"); } } ?> <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <table cellspacing=0 cellpadding=4 border=0 class="bodytext" width="100%"> <tr> <td><strong>Would you like to be added to our mailing list?</strong></td> <td><input name="MailingList" type="radio" value="Yes"> Yes <input name="MailingList" type="radio" value="No"> No Thanks </td> </tr> <tr> <td></td> <td><input name="submit" type="submit" value="Tell Me More!"> </td> </tr> </table> Link to comment https://forums.phpfreaks.com/topic/129174-head-hits-wall-instead-of-a-simple-form/#findComment-669708 Share on other sites More sharing options...
afterzero Posted October 20, 2008 Author Share Posted October 20, 2008 brilliant! thanks!!!!! j Link to comment https://forums.phpfreaks.com/topic/129174-head-hits-wall-instead-of-a-simple-form/#findComment-669709 Share on other sites More sharing options...
afterzero Posted October 20, 2008 Author Share Posted October 20, 2008 update... all it does is take me back to the contact form page....not the actual header locations to explain again....if the user selects the yes radio button i want the form data to be sent to a script multidouble.ice but if they select no...the form data does NOT get passed to the script and they get redirected to a thank you page here is the entire form: <?php if(isset($_POST['MailingList'])){ $MailingList=$_POST['MailingList']; if($MailingList=='Yes'){ header("location: http://www.icebase.com/multidouble.ice"); } if($MailingList=='No'){ header("location: thankyou.htm"); } } ?> <table width="670" border="0" align="center"> <tr> <td><img src="contact.gif" style="margin-top:12px;" width="500" height="40"><br> <table width="670" cellspacing="0" cellpadding="0" border="0"> <tr align="left" valign="top"> <td width="330" ><table width="350" cellspacing="0" cellpadding="5" style="border-style:solid; border-width:1px"> <tr> <td><form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <table cellspacing=0 cellpadding=4 border=0 class="bodytext" width="100%"> <tr> <td><b>Name:</b><br> </td> <td><input type="text" name="name" size="30" maxsize="50"> </td> </tr> <tr> <td><b>Company:</b><br> </td> <td><input type="text" name="company" size="30" maxsize="50"> </td> </tr> <tr> <td class="bodytext"><b>Address:</b></td> <td><input type="text" name="address" size="30" maxsize="50"> </td> </tr> <tr> <td><br> </td> <td><input type="text" name="address2" size="30" maxsize="50"> </td> </tr> <tr> <td class="bodytext"><b>City:</b></td> <td><input type="text" name="city" size="30" maxsize="50"> </td> </tr> <tr> <td> </td> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><span class="bodytext"><b>State</b></span><b>:</b> <input type="text" name="state" size="2" maxsize="20"> </td> <td><span class="bodytext"><b>Zip</b></span><b>:</b> <input type="text" name="zip" size="10" maxsize="20"> </td> </tr> </table></td> </tr> <tr> <td class="bodytext"><strong>Country:</strong></td> <td><input type="text" name="country" size="24" maxsize="50"> </td> </tr> <tr> <td class="bodytext"><b>Phone:</b></td> <td><input type="text" name="phone" size="24" maxsize="50"> </td> </tr> <tr> <td class="bodytext"><b>E-mail Address:</b></td> <td><input type="text" name="email" size="30" maxsize="50"> </td> </tr> <tr> <td><strong>Web Site: </strong></td> <td><input type="text" name="website" size="30" maxsize="50"> </td> </tr> <tr> <td><strong>Management<br> Software:</strong></td> <td><select name="user1" size="1"> <option value="None">Choose One...</option> <option value="Centershift">Centershift</option> <option value="DOMICO">DOMICO</option> <option value="eMove">eMove</option> <option value="Hi-Tech">Hi-Tech Rent Plus</option> <option value="In_House">In House</option> <option value="PTI">PTI Taskmaster</option> <option value="QuikStor">QuikStor</option> <option value="Sentinel">Sentinel WIN-SEN</option> <option value="Shurdini">Shurdini</option> <option value="SiteLink">SMD Software - SiteLink</option> <option value="Space_Control">Space Control</option> <option value="Space_Manager">Space Manager</option> <option value="STORMAN">STORMAN</option> <option value="Empower">Storage Commander</option> <option value="Syrasoft">Syrasoft</option> <option value="Other">Other</option> </select></td> </tr> <tr> <td><b>Comments:</b><br> </td> <td><textarea name="user2" cols=22></textarea> </td> </tr> <tr> <td><b>Facility Type:</b></td> <td><input name="user3" type="radio" value="Existing Facility"> Existing <input name="user3" type="radio" value="New Build"> New Build</td> </tr> <tr> <td><b>How many units?</b></td> <td><input name="user4" type="text"> </td> </tr> <tr> <td><strong>How did you hear about us? </strong></td> <td><select name="user5" size="1"> <option value="None">Choose One...</option> <option value="ISS">Inside Self Storage</option> <option value="Internet-Search">Internet Search</option> <option value="MSM">Mini Storage Messenger</option> <option value="Press Release">Press Release</option> <option value="Saw-INSOMNIAC-someplace">Saw INSOMNIAC working</option> <option value="TSSA Magazine">Self-Storage News (TSSA)</option> <option value="Self-Storage-Now">Self Storage Now</option> <option value="SelfStorageGuide">SelfStorageGuide.com</option> <option value="Globe">SSA Globe</option> <option value="ISS-Tradeshow">Tradeshow - ISS</option> <option value="SSA-Tradeshow">Tradeshow - SSA</option> <option value="Friend/Referral">Friend / Referral</option> <option value="Partner">OpenTech Partner</option> <option value="Other">Other</option> </select></td> </tr> <tr> <td><strong>When might you need a kiosk? </strong></td> <td><select name="user6" size="1"> <option value="None">Choose One...</option> <option value="Right Away">Right Away</option> <option value="1-3 Months">1-3 Months</option> <option value="3-6 Months">3-6 Months</option> <option value="6-12 Months">6-12 Months</option> <option value="1-2 Years">1-2 Years</option> <option value="No Plans">No Plans, Just Learning</option> </select></td> </tr> <tr> <td><strong>Would you like to be added to our mailing list?</strong></td> <td><input name="MailingList" type="radio" value="Yes"> Yes <input name="MailingList" type="radio" value="No"> No Thanks </td> </tr> <tr> <td></td> <td><input type="submit" value="Tell Me More!"> </td> </tr> </table> <input type=hidden name="username" value="username"> <input type=hidden name="notification"value="[email protected]"> <input type=hidden name="list0" value="listname"> <input type="hidden" name="allow_update" value="yes"> <input type="hidden" name="notificationSubject" value="Information Request"> <input type="hidden" name="thankyou_message" value="http://url.com/contact_us/thankyou.htm"> </form></td> </tr> </table></td> Link to comment https://forums.phpfreaks.com/topic/129174-head-hits-wall-instead-of-a-simple-form/#findComment-669719 Share on other sites More sharing options...
afterzero Posted October 20, 2008 Author Share Posted October 20, 2008 would i need to pass the form data to separate php script to collect it then if they checked the box have that script send the info to the multidouble.ice? Link to comment https://forums.phpfreaks.com/topic/129174-head-hits-wall-instead-of-a-simple-form/#findComment-669726 Share on other sites More sharing options...
Bendude14 Posted October 20, 2008 Share Posted October 20, 2008 that would work... retrieve all the info... then check if its yes and no and pass it to another script using header and adding the vars on to the end of the URL so you can retrieve them using GET Link to comment https://forums.phpfreaks.com/topic/129174-head-hits-wall-instead-of-a-simple-form/#findComment-669730 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.