okay guys ive got this page in which i want to verify the key that the user inputs with the key in my sql database, and then it updates a row called user_okay when i click on the enter button.

<?php session_start(); 

include ('dbc.php'); 

	//if ($_POST['Submit']=='Enter')
//	{
		$keys = rand(10000,99999);
		$id = $_SESSION['user_name'];
		mysql_query("UPDATE `users`  SET `key` = '$keys' WHERE `id` = '$id'") or 				die(mysql_error());
		$_SESSION['rkey'] = $keys;
		echo $_SESSION['rkey'];
		if ($keys == "$_POST('key')")
			mysql_query("UPDATE `users`  SET `user_okay` = '1' WHERE `id` = '$id'				") or 				die(mysql_error());
//	}


<table width="65%" border="0" cellpadding="0" cellspacing="0">
    <td bgcolor="d5e8f9" class="mnuheader"><strong><font size="5">Test</font></strong></td>
    <td bgcolor="e5ecf9" ><form name="form1" method="post" action="" style="padding:5px;">
    	Time issued:
  		<input name="time" type="text" id="time">
    	<img src="pngimg1.php" align="middle">&nbsp; </p>
    	Please enter your coloured key:
  		<input name="key" type="text" id="key">
     	<p align="center"> 
      	<input type="Submit" name="Submit" id="Submit" value="Enter">

however, when i click on the enter button, it always refreshes the page only. i would like to redirect the user to another page if my above action is successfull. Any idea?

7 Years
Discussion Span
Last Post by pin8marian

after your update is successful you need to use

header("Location: nextpage.php");

make sure you have ob_start(); at the top of your document as well before anything else

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.