debug help with statement?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mmc01ms
Forum Commoner
Posts: 97
Joined: Wed Dec 01, 2004 3:33 am
Location: Nottingham, UK

debug help with statement?

Post by mmc01ms »

can anyone see whats wrong with this statment it returns no error just a white screen when those fields are not entered?

statment is:

Code: Select all

if((!isset($_POSTї'story'])) || (!isset($_POSTї'headline'])))
	{
		error_message("Enter all fields");
		
	}
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

think you may be better doing this

Code: Select all

if((empty($_POSTї'story'])) || (empty($_POSTї'headline'])))
	{
		error_message("Enter all fields");
		
	}
becuase even if the user doesn't enter them field, the POST values are still set
mmc01ms
Forum Commoner
Posts: 97
Joined: Wed Dec 01, 2004 3:33 am
Location: Nottingham, UK

Post by mmc01ms »

cheers for that however the script doesn't like the syntax of that code this is what i give it

Code: Select all

if((empty($_POSTї'story'])) || ((empty($_POSTї'headline']))
	{ 
		error_message("Enter all fields"); 
		
	}

error is:

Code: Select all

Parse error: parse error, unexpected '{' in /home/sites/manpreetsandhu.com/public_html/article_submit.php on line 32
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you're missing a closing paren... come on now..

edit: darn spelling.
Last edited by feyd on Fri Jan 28, 2005 9:00 am, edited 1 time in total.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

i think what my good friend feyd is saying is it shoule be this :D

Code: Select all

if((empty($_POSTї'story'])) || ((empty($_POSTї'headline'])))
   { 
      error_message("Enter all fields"); 
       
   }
mmc01ms
Forum Commoner
Posts: 97
Joined: Wed Dec 01, 2004 3:33 am
Location: Nottingham, UK

Post by mmc01ms »

doeswn't matter which way i put it it's the same error it doesn't like the braces?

Code: Select all

if((empty($_POSTї'story'])) || ((empty($_POSTї'headline']))) {
		error_message("Enter all fields"); 
	}
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

your code is still missing a closing paren. Count the parens.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

ive spotted it!!! have you!?!? :lol: 8)
mmc01ms
Forum Commoner
Posts: 97
Joined: Wed Dec 01, 2004 3:33 am
Location: Nottingham, UK

Post by mmc01ms »

yes sorry im having a nightmare day today! It just comes up with another error now something about Boolean. I'll check it out later. cheers guys
Post Reply