Re: [PHP] redirect browser
may be my message are hazy. the line = is not include in my php code/page, i just use it in this message as to divide into different section. Joe Jason Wong [EMAIL PROTECTED] ???:[EMAIL PROTECTED] On Saturday 20 April 2002 09:26, Joe wrote: = ?php Warning: Cannot add header information - headers already sent by (output started at c:\html\html\check.php:4) in c:\html\html\check.php on line 42 I had no idea about this. Can anyone tell me what's wrong of my code? You cannot have anything between the beginning of the file and your ?php tag. Not even whitespace (spaces, tabs, newlines etc). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* A real person has two reasons for doing anything ... a good reason and the real reason. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect browser
On Saturday 20 April 2002 18:49, Joe wrote: may be my message are hazy. the line = is not include in my php code/page, i just use it in this message as to divide into different section. Whatever, the answer is still the same: You cannot have anything between the beginning of the file and your ?php tag. Not even whitespace (spaces, tabs, newlines etc). Check all your include() files as well for any stray space. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Lead us in a few words of silent prayer. -- Bill Peterson, former Houston Oiler football coach */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect browser
make sure that this script is not insterted into an html document but it's a stand alone page eg. checkstudent.php. When the student submits their number your form should bring them here (form action=checkstudent.php method=post) and the page will do its job. Make sure however that there is no output (don't print to screen) on that page except error messages in your if statements or you will get errors. R I had developed the web-based survey for student. And I need to check that each only fill in the form once time. So I write following code to check if the student number exist in the database or not. if yes, don't let them to fill in again. if no, redirect the browser to the page for them to fill in. = ?php $db = mysql_pconnect(localhost, survey, survey); if (!$db) { echo Error: Could not connect to database.; exit; } mysql_select_db(survey); $query = mysql_query(select * from surveydb where studno = '$studno'); $result = mysql_num_rows($query); if ($result=1) { echo Student Number $studno already existed in the database.brbr .You don't need to input again!; } else { header(Location: http://www.XXX.edu/index.php;); exit; } ? = the code can check the student no. are exist in database or not but the browser don't redirect to the page if student not exist in database and display the following error code: Warning: Cannot add header information - headers already sent by (output started at c:\html\html\check.php:4) in c:\html\html\check.php on line 42 I had no idea about this. Can anyone tell me what's wrong of my code? Thx! Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --__-__-__ eat pasta type fasta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] redirect browser
I had developed the web-based survey for student. And I need to check that each only fill in the form once time. So I write following code to check if the student number exist in the database or not. if yes, don't let them to fill in again. if no, redirect the browser to the page for them to fill in. = ?php $db = mysql_pconnect(localhost, survey, survey); if (!$db) { echo Error: Could not connect to database.; exit; } mysql_select_db(survey); $query = mysql_query(select * from surveydb where studno = '$studno'); $result = mysql_num_rows($query); if ($result=1) { echo Student Number $studno already existed in the database.brbr .You don't need to input again!; } else { header(Location: http://www.XXX.edu/index.php;); exit; } ? = the code can check the student no. are exist in database or not but the browser don't redirect to the page if student not exist in database and display the following error code: Warning: Cannot add header information - headers already sent by (output started at c:\html\html\check.php:4) in c:\html\html\check.php on line 42 I had no idea about this. Can anyone tell me what's wrong of my code? Thx! Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect browser
On Saturday 20 April 2002 09:26, Joe wrote: = ?php Warning: Cannot add header information - headers already sent by (output started at c:\html\html\check.php:4) in c:\html\html\check.php on line 42 I had no idea about this. Can anyone tell me what's wrong of my code? You cannot have anything between the beginning of the file and your ?php tag. Not even whitespace (spaces, tabs, newlines etc). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* A real person has two reasons for doing anything ... a good reason and the real reason. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php