raj86 Posted October 28, 2009 Share Posted October 28, 2009 Hello friends i am working on payentry page ..there i have this code......... $str="select MAX(PSRN) from paymajor"; $result=mysql_query($str) or die(mysql_error()); while($row=mysql_fetch_assoc($result)) { $psrn=$row['MAX(PSRN)']+1; } i need to print $psrn value in the success page......for that i am using header ('Location: http://localhost/bitssap/success.php'); but after success its showing this meassage Data entered successfully. The PSRN generated is $psrn i am not able to print the value of psrn on success page can anybody suggest me how to do this... Link to comment https://forums.phpfreaks.com/topic/179306-solved-how-to-get-variable-value-on-next-page/ Share on other sites More sharing options...
joel24 Posted October 28, 2009 Share Posted October 28, 2009 are you passing the $psrn with a session or through the URL? i.e. header ('Location: http://localhost/bitssap/success.php?psrn=' .$psrn); then on the success page $psrn = $_GET['psrn']; Link to comment https://forums.phpfreaks.com/topic/179306-solved-how-to-get-variable-value-on-next-page/#findComment-946064 Share on other sites More sharing options...
raj86 Posted October 28, 2009 Author Share Posted October 28, 2009 how to use it through URL....I HAVE CUT AND PASTE YOUR CODE but its not working for me Link to comment https://forums.phpfreaks.com/topic/179306-solved-how-to-get-variable-value-on-next-page/#findComment-946069 Share on other sites More sharing options...
joel24 Posted October 28, 2009 Share Posted October 28, 2009 can you show me the code of both pages? Link to comment https://forums.phpfreaks.com/topic/179306-solved-how-to-get-variable-value-on-next-page/#findComment-946084 Share on other sites More sharing options...
raj86 Posted October 28, 2009 Author Share Posted October 28, 2009 payentry page $str="select MAX(PSRN) from paymajor"; $result=mysql_query($str) or die(mysql_error()); while($row=mysql_fetch_assoc($result)) { $psrn=$row['MAX(PSRN)']+1; } $query = "INSERT INTO `paymajor` ......... $result = mysql_query($query) or die ("Error in query: $query"); if($result) { header ('Location: http://localhost/bitssap/success.php?psrn=' .$psrn); } success page <?php session_start(); $psrn = $_GET['psrn']; ?> <html> <head> <title>Success</title> </head> <hr style="color:#33FF00"> <center> <h1 style="color:#000099">Data entered successfully. The PSRN generated is $psrn</h1> </head> <body bgcolor="#CCCCCC"> <input type="button" name="submit2" value="Pay Entry" onclick='window.location="http://localhost/bitssap/payentry.php"' /> <input type="button" name="submit2" value="Main Menu" onclick='window.location="http://localhost/bitssap/index.php"' /> </center> </body> </html> Link to comment https://forums.phpfreaks.com/topic/179306-solved-how-to-get-variable-value-on-next-page/#findComment-946089 Share on other sites More sharing options...
tastro Posted October 28, 2009 Share Posted October 28, 2009 just echo $psrn on the success page. now that you have send it via url already. header ('Location: http://localhost/bitssap/success.php?psrn=' .$psrn); Link to comment https://forums.phpfreaks.com/topic/179306-solved-how-to-get-variable-value-on-next-page/#findComment-946216 Share on other sites More sharing options...
raj86 Posted October 28, 2009 Author Share Posted October 28, 2009 thanks its working Link to comment https://forums.phpfreaks.com/topic/179306-solved-how-to-get-variable-value-on-next-page/#findComment-946256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.