vfragk Posted October 27, 2008 Share Posted October 27, 2008 i have a form with multiple selection fields that comes up from specific table fields of an MYSQL db. when i'm submitting the form i want to GET the values of the fields and use them as multiple selection fields to another form. here is my code: test1.php ...... <form id="form1" name="form1" method="post" action="test2.php"> <?php include '../config.php'; include '../opendb.php'; $result = mysql_query("SELECT * FROM country"); ?> <label>choose section<br/> <select name="tmima[]" size="10" multiple="multiple" id="tmima"> <? while($row = mysql_fetch_array($result)) { echo "<option value=\"".$row ['OT'] . "\"> " . $row ['OT'] . "</option> "; }?> </select> <br/> </label> <? include '../closedb.php'; ?> <input type="reset" name="button2" id="button2" value="reset" /> <input type="submit" name="button" id="button" value="submit" /> </label><br/></form> ..... test2.php .... <? $tmima = $_GET['tmima']; ?> .... <form id="form2" name="form2" method="post" action="test3.php"> <label>choose name<br/> <select name="tm[]" size="10" multiple="multiple" id="tm"> <? $tmima=$_POST['tmima']; if ($tmima){ foreach ($tmima as $t){ echo "<option value=\"".$t . "\"> " . $t . "</option> ";}} ?> </select> <br/></label> <input type="reset" name="button3" id="button3" value="reset" /> <input type="submit" name="button4" id="button4" value="submit" /> </form> .............. what im doing wrong?isn't it possible to pass values to another page-form? Link to comment https://forums.phpfreaks.com/topic/130336-form-data-post-to-another-form/ Share on other sites More sharing options...
Fruct0se Posted October 27, 2008 Share Posted October 27, 2008 try changing $_GET to $_POST, you are using the post method for your form. Link to comment https://forums.phpfreaks.com/topic/130336-form-data-post-to-another-form/#findComment-675977 Share on other sites More sharing options...
vfragk Posted October 27, 2008 Author Share Posted October 27, 2008 thanks...all comes ok now Link to comment https://forums.phpfreaks.com/topic/130336-form-data-post-to-another-form/#findComment-676013 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.