luvburn Posted September 27, 2006 Share Posted September 27, 2006 Hi...i have this problem of linking 2 pages from one button. Let say i have 3 pages. I want to send the values from page 1 to page 2 and 3.This the code for page 1 which i set the action to go to page2[code]<?php <form name="form1" method="get" action="page2.php"><table width="585" align="center"><tr><td>Umur :</td><td ><input type="radio" name="umur" value="1"> < 1 tahun</td><td ><input type="radio" name="umur" value="2" >1 - 10 tahun</td><td><input type="radio" name="umur" value="3" > 11 - 19 tahun</td><td ><input type="radio" name="umur" value="4" > 19 tahun</td></tr></table><input type="submit" name="submit" value="Teruskan" ></form> ?>[/code]I can simply get the values at page2 by using $_GET. How do i do the same action to page 3 by clicking the submit button and retrieving the same values so that whenever i go to page3 the values from page1 is already there.Where should i put the link? Quote Link to comment Share on other sites More sharing options...
warewolfe Posted September 27, 2006 Share Posted September 27, 2006 Hej Use sessions? page one hassession_start();$_SESSION["data1"]=$data1; andpage three hassession_start();$data1 = $_SESSION['data1'];WW Quote Link to comment Share on other sites More sharing options...
mitzleah Posted September 27, 2006 Share Posted September 27, 2006 use session variables instead of get variables Quote Link to comment Share on other sites More sharing options...
luvburn Posted September 27, 2006 Author Share Posted September 27, 2006 The session is not working. Somehow i want to use the values in page2. So i use $_GET to get the values from page 1 using the URL links. After that i want to send the values to page3.Page 2 has a lot of server side functions. The values only appear for the first time we view the page butlost each time some of those functions operated. So how do i hold the values from page1 no matter functions operated in page2.this the code in page 2[code]<?phpinclude ('mysql_connect.php');include ('papar_fungsi.php');session_start();session_name ('diagnos'); $_SESSION['age'] = $_GET["umur"]; $_SESSION['sex'] = $_GET["jantina"]; $_SESSION['race'] = $_GET["kaum"];?><form name="form1" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"><?php: $_SESSION['age'] ....(a lot of php function here)?></form><?php echo "<a href=\"senarai_simptom.php?a=$age\">Simptom</a> " ; ?>[/code]I want the values to be send after clicking the 'Simptom' link but as i said before, the values lost before i can send to page3. Quote Link to comment Share on other sites More sharing options...
warewolfe Posted September 27, 2006 Share Posted September 27, 2006 Hej, If sessions are not working for you && you are using a form on both page 1 and page 2 && and you need data passed from page 1 to go to page 3 then use input type="hidden" fields to pass data along. 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.