Current location: Hot Scripts Forums » Programming Languages » PHP » problem with exit();


problem with exit();

Reply
  #1 (permalink)  
Old 01-15-06, 03:28 PM
fraggle fraggle is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
problem with exit();

i have this code

if(!$pcode){
echo "Postcode is a required field. Please enter it below.<br />";
}
echo "<br>";
include 'rform.php';
exit(); // Here is the problem!
}

The required field check works and the form is included but the rest of my page does not load, it exits from displaying anything. is there a way that i can exit from the next stage of the script but still show the rest of my html?
__________________
~Fraggle is Frazzled~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-15-06, 03:54 PM
Vineman Vineman is offline
Wannabe Coder
 
Join Date: Dec 2005
Location: Texas
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
The reason the rest of your page isnt being displayed is because of exit();. It stops the code from running from that point on. To fix this, try ending the PHP area and then using the rest of the HTML as just HTML, and dont echo it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-16-06, 04:02 AM
Ligx Ligx is offline
Newbie Coder
 
Join Date: Nov 2005
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
You could try to rewrite it to do this:
PHP Code:

$errormsg "";


if (
$pcode == ""){$errormsg "<li>Postcode is a required field</li>";}
// And if you want other requirements...

if ($username == ""){$errormsg "".$errormessage."<li>Username is a required field</li>;} 
This should work. If not, I have made a mistake in repeating the errormessage. But fi you find the error, it would work juust fine =)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in donwloading document using header tejash PHP 3 11-19-05 03:48 AM
Weird mysql_query and Smarty problem Canglan PHP 3 11-15-05 09:49 PM
Count problem kasic ASP.NET 1 10-20-04 01:23 AM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 10:13 AM
Please Help me Get rid of this parse error gmjan6 PHP 5 06-19-04 01:48 AM


All times are GMT -5. The time now is 11:30 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.