matt.sisto Posted March 20, 2009 Share Posted March 20, 2009 Hello I am struggling getting this form to post to 2 separate locations depending on the submit button activated how can I do this? <!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><?php echo "date" ?></title> <script language="JavaScript"> function win2() { window.open("checkavailability.php","Window2","menubar=no,width=460,height=360,toolbar=no"); } </script> </head> <body> <legend> Event Details <form method="post" action="addevent.php"> <input type="text" name="event_title" size="25" maxlength="25" value="<?=$row['event_title']?>"/></p> <p><strong>Event Description:</strong><br/> <input type="text" name="event_shortdesc" size="25" maxlength="255" value="<?=$row['event_shortdesc']?>"/></p> <p><strong>Event Date:</strong><br/> <select name="year" value="<?=$row['y']?>"> <?php $yeartoday = date(Y); $yearplus1 = date(Y)+1; for($y=$yeartoday;$y<=$yearplus1;$y++){ $selected = ""; $longDate = date("Y", mktime(0,0,0,1,1,$y)); if ($Year==$y){ $selected = "selected \n"; } echo "<option value=\"$y\" $selected>$longDate</option> \n"; } ?> </select> <select name="month" value="<?=$row['m']?>"/> <?php $months = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); for ($x=1; $x <= count($months); $x++) { echo"<option value=\"$x\""; if ($x == $month) { echo " selected"; } echo ">".$months[$x-1]."</option>"; } ?> </select> <select name="day" value="<?=$row['d']?>"> <?php for ($x= 1; $x<=31; $x++) { echo "<option"; if ($x == $day) { echo " selected"; } echo ">$x</option>"; } ?> </select> <p><input type ="submit" value="confirm"/> <input type="button" onClick="javascript:self.close()" value="close"> <input type="submit" onClick="javascript:win2()" value="Check Availability"></p> </legend> </form> </body> </html> Appreciate any help. Quote Link to comment https://forums.phpfreaks.com/topic/150370-solved-form-action-2-locations/ Share on other sites More sharing options...
Yesideez Posted March 20, 2009 Share Posted March 20, 2009 You can't have them go to different locations, all you can do is check for each submit button wherever your form is pointing to. if ($_POST['event_title']) { //handle title here } if ($_POST['event_shortdesc']) { //handle shortdesc here } Quote Link to comment https://forums.phpfreaks.com/topic/150370-solved-form-action-2-locations/#findComment-789701 Share on other sites More sharing options...
matt.sisto Posted March 20, 2009 Author Share Posted March 20, 2009 I haven't explained what it is I want to do properly. When the client selects a date they can check the availability or add an event, depending on the submit button activated. But the date value must be used in the addevent.php or chekavailabilty.php. http://www.salmonsreach.org/cal.php if you activate a link to a date, then the addeventform.php opens in a popup window. Perhaps if you have a look at the form it would be easier to understand. Quote Link to comment https://forums.phpfreaks.com/topic/150370-solved-form-action-2-locations/#findComment-789708 Share on other sites More sharing options...
Yesideez Posted March 20, 2009 Share Posted March 20, 2009 Sorry but now you've lost me completely! Quote Link to comment https://forums.phpfreaks.com/topic/150370-solved-form-action-2-locations/#findComment-789710 Share on other sites More sharing options...
matt.sisto Posted March 20, 2009 Author Share Posted March 20, 2009 I want the date to be posted to the addevent script when submit1 is activated, but to the ceckavailability script when submit2 is activated. I don't know how to explain it in a less confusing way. Sorry Quote Link to comment https://forums.phpfreaks.com/topic/150370-solved-form-action-2-locations/#findComment-789899 Share on other sites More sharing options...
redarrow Posted March 20, 2009 Share Posted March 20, 2009 Tell us the whole story, how it works, then where get a good i dear mate? go slowly and gentle we are human Quote Link to comment https://forums.phpfreaks.com/topic/150370-solved-form-action-2-locations/#findComment-789906 Share on other sites More sharing options...
matt.sisto Posted March 20, 2009 Author Share Posted March 20, 2009 I will have a think about the best way to explain it and get back to you. Quote Link to comment https://forums.phpfreaks.com/topic/150370-solved-form-action-2-locations/#findComment-789962 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.