Re: [PHP] i need delay time in doing array_key_exists but while(true) can't work 4 it.
On Fri, 2011-05-20 at 19:46 +0430, Negin Nickparsa wrote: > the thing that is important to me is setting session > because i want the tables of the one that clicked be showed on patient.php > how can i change my wrong code? You have to realise that PHP code runs on the server, all before it sends the output to your browser. A basic example works like this: 1. You request a page in your browser by typing in the URL 2. The server receives this request 3. The server then does whatever processing is in the script (assuming you requested a .php file) and it is the script which is responsible for your HTML output 4. The web server sends this output back to your browser If you need things to be run on the server as a result of you doing something in your browser, then you need to either trigger some sort of page refresh or new page request, or use Javascript to make a series of AJAX requests. PHP code isn't run in your browser, and it knows nothing about what you do in it. For that, you need a client-side language such as Javascript. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] i need delay time in doing array_key_exists but while(true) can't work 4 it.
the thing that is important to me is setting session because i want the tables of the one that clicked be showed on patient.php how can i change my wrong code?
Re: [PHP] i need delay time in doing array_key_exists but while(true) can't work 4 it.
i can't understand what u wanted to tell me. i want to when clicking on the sub button then go to another page i wrote it but i can't solve this problem: php runs the code and "then" i click it i don't know,how can i solve it any suggestion?
Re: [PHP] i need delay time in doing array_key_exists but while(true) can't work 4 it.
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.phpdecide 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: > 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 ""; > for($i=0;$i<$num;$i++) > { > $row=mysql_fetch_row($result); > echo ""; > for($j=0;$j<$num1;$j++) > { > echo"$row[$j]"; > } > echo""; > echo""; > } > echo""; > } > } > if(array_key_exists('sub5',$_POST)) > { > $_SESSION[s1]=$row[0]; > header("Location: patient.php?"); > } > ?> > > > Doctor > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] i need delay time in doing array_key_exists but while(true) can't work 4 it.
===>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: 0) { echo ""; for($i=0;$i<$num;$i++) { $row=mysql_fetch_row($result); echo ""; for($j=0;$j<$num1;$j++) { echo"$row[$j]"; } echo""; echo""; } echo""; } } if(array_key_exists('sub5',$_POST)) { $_SESSION[s1]=$row[0]; header("Location: patient.php?"); } ?> Doctor