light-angel Posted April 15, 2011 Share Posted April 15, 2011 im building a form in php and is their away to have a submit or continue button on the same page so if ya want to fill in more it will go to the next page if not it will e-mail the info Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted April 15, 2011 Share Posted April 15, 2011 Yes. The easiest would be to use a checkbox/radio button to choose the option, and then have the php that proccess the first page of the form check that value first and decide what to do. Quote Link to comment Share on other sites More sharing options...
light-angel Posted April 15, 2011 Author Share Posted April 15, 2011 so would it be something like this? <script type="text/javascript"> <!-- function goToSite(yn) { if(yn=='yes') { location.href='/email.php'; } else { location.href='/page10.php'; } } //--> </script> <form action="#"> <div> <input type="radio" name="ES" value="yes" onclick="goToSite(this.value)"><label>Yes</label> <input type="radio" name="ES" value="no" onclick="goToSite(this.value)"><label> No</label> </div> </form> Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted April 15, 2011 Share Posted April 15, 2011 If you want to do it in javascript, sure something like that would probably get the job done just fine - assuming the EU has java enabled on their browser. you can also use PHP on the form action page to say <?php if ($_POST['flag'] == 'TRUE'){ include_once "page2.php"; } else { //mail script goes here include_once "thankUser.php"; } ?> Quote Link to comment Share on other sites More sharing options...
light-angel Posted April 15, 2011 Author Share Posted April 15, 2011 just tryed this <?php if(!empty($_POST["radio_A/B"])) { header('location: $_POST["radio_A/B"]'); exit; } ?> <form action="#" method="post" enctype="multipart/form-data"><br> Professional:<br><em>Qualifications, memberships, fellowships or affiliations upon which your professional status relies</em> <br><textarea NAME="Professional" ROWS=5 COLS=35></textarea><BR><BR> Higher Education<br><em>Degree/class/university</em> <br><textarea NAME="Higher Education" ROWS=5 COLS=35></textarea><BR><BR> Further Education:<br><em>Diplomas/Certificates</em> <br><textarea NAME="Further Education" ROWS=5 COLS=35></textarea><BR><BR> Secondary Education<br><em>Name and place of school, A and O level subjects/grades,GCSE subjects/grades, other subjects/grades (grades may be omitted if preferred) </em> <br><textarea NAME="Secondary Education" ROWS=5 COLS=35></textarea><BR><BR> Vocational Training:<br><em>Courses, certificates, coaching (including IT)</em> <br><textarea NAME="Vocational Training" ROWS=5 COLS=35></textarea><BR><BR> Computer Literacy<br><em>Software of which you have knowledge or experience, even if there is no qualification</em> <br><textarea NAME="Computer Literacy" ROWS=5 COLS=35></textarea><BR><BR> Languages<br><em>Normally shown only if fluent</em> <br><textarea NAME="Languages" ROWS=5 COLS=35></textarea><BR><BR> A<input type="radio" name="radio_A/B" value="pageX.php"> B<input type="radio" name="radio_A/B" value="pageZ.php"> <input type="submit" value="Continue" /> </form> and all it dose is show the pagename with a # after it and not going to the page sorry if im being stupid Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted April 15, 2011 Share Posted April 15, 2011 <input type="radio" name="radio_A/B" value="TRUE" />I want to answer More Questions!<br /> should work with <?php if($_POST['radio_A/B'] == 'TRUE') { header('location: '.$_POST['radio_A/B']); exit; } I think the problem was mainly that you had used double quotes inside the POST[] square brackets. be carefull using the header redirect as well, you can easily loose your information bouncing through too many pages without using sessions to keep it in. Quote Link to comment Share on other sites More sharing options...
analog Posted April 15, 2011 Share Posted April 15, 2011 You need to change the # in the forms HTML action attribute to the URL of the PHP script you want the post data sent to. So instead of: <form action="#" method="post" enctype="multipart/form-data"> it would be: <form action="http://www.example.com/handleform.php" method="post" enctype="multipart/form-data"> Quote Link to comment Share on other sites More sharing options...
light-angel Posted April 15, 2011 Author Share Posted April 15, 2011 <?php if($_POST['radio_A/B'] == 'TRUE') { header('location: '.$_POST['radio_A/B']); exit; } ?> <form action="send.php" method="post" enctype="multipart/form-data"><br> Professional:<br><em>Qualifications, memberships, fellowships or affiliations upon which your professional status relies</em> <br><textarea NAME="Professional" ROWS=5 COLS=35></textarea><BR><BR> Higher Education<br><em>Degree/class/university</em> <br><textarea NAME="Higher Education" ROWS=5 COLS=35></textarea><BR><BR> Further Education:<br><em>Diplomas/Certificates</em> <br><textarea NAME="Further Education" ROWS=5 COLS=35></textarea><BR><BR> Secondary Education<br><em>Name and place of school, A and O level subjects/grades,GCSE subjects/grades, other subjects/grades (grades may be omitted if preferred) </em> <br><textarea NAME="Secondary Education" ROWS=5 COLS=35></textarea><BR><BR> Vocational Training:<br><em>Courses, certificates, coaching (including IT)</em> <br><textarea NAME="Vocational Training" ROWS=5 COLS=35></textarea><BR><BR> Computer Literacy<br><em>Software of which you have knowledge or experience, even if there is no qualification</em> <br><textarea NAME="Computer Literacy" ROWS=5 COLS=35></textarea><BR><BR> Languages<br><em>Normally shown only if fluent</em> <br><textarea NAME="Languages" ROWS=5 COLS=35></textarea><BR><BR> <input type="radio" name="radio_A/B" value="TRUE" />I want to answer More Questions!<br /> <input type="submit" value="Continue" /> </form> doing it like that if i select the radio button or not it goes str8 to the send.php but i want it so if its checked goes to the learn1.php and i have got secions saved @ the top of the script Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted April 15, 2011 Share Posted April 15, 2011 you need to set the <form action"" to point to the current page, not to send.php. setting it to send.php just takes you directly to it. Use an else{} after the if to move to the send.php in the event that the radio button is not selected. Quote Link to comment Share on other sites More sharing options...
light-angel Posted April 15, 2011 Author Share Posted April 15, 2011 ty for all ya help Quote Link to comment 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.