Re: i need delay time in doing array_key_exists but while(true) can't work 4 it.

From: Date: Fri, 20 May 2011 15:09:15 +0000
Subject: Re: i need delay time in doing array_key_exists but while(true) can't work 4 it.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-312971@lists.php.net to get a copy of this message
Negin, You cannot "pause" PHP. You need to do your checking and header() redirect on a processing page that your form is submitting to. file process form.php Displays form process.php decide what to you, redirect to secondary page secondary.php display your secondary page On 5/20/2011 7:54 AM, Negin Nickparsa wrote: > ===>if(array_key_exists('sub5',$_POST)) > this line runs before i clicked on the submit > while(true) before this line can't work then how can i solve the time > problem? > here is the whole code: > <?php > session_start(); > > $connection=Mysql_connect('localhost','admin','123'); > if(array_key_exists('sub3',$_POST)) > { > > > if(!$connection) > { > echo 'connection is invalid'; > } > else > { > Mysql_select_db('drugnet',$connection); > $query="select * from patient"; > $result=mysql_query($query); > $num=Mysql_num_rows($result); > $num1=Mysql_num_fields($result); > } > if($num>0) > { > echo "<table border=2>"; > for($i=0;$i<$num;$i++) > { > $row=mysql_fetch_row($result); > echo "<tr>"; > for($j=0;$j<$num1;$j++) > { > echo"<td>$row[$j]</td>"; > } > echo"<td><input type='submit' name='sub5' value='patient > file$row[0]'/></td>"; > echo"</tr>"; > } > echo"</table>"; > } > } > if(array_key_exists('sub5',$_POST)) > { > $_SESSION[s1]=$row[0]; > header("Location: patient.php?"); > } > ?> > <html> > <head> > <title>Doctor</title> > <form method="post"> > <input type="submit" name="sub3" value="patient list"/> > <input type="submit" name="sub4" value="search patient"/> > > </form> > </head> > </html> >

« previous php.general (#312971) next »