Simple problem. I have a form where I fill in the value of $ing1 & $ing2. Then it's sent to page witch creates another page but containig the values from the form page.
This part of the script should check if I entered $ing1 and when I would, it should write all dose thing.(fwrite and all)...if not it should leave out the fwrite things and go to the second if(ing2),or fwrite all those thing and go to the second $ing2...can any one tell me what I'm doing wrong??because it's not working
if (isset($ing1))
{
fwrite($file,'$ing1');fwrite($file,'');fwrite($file,'');
}
else {break;}
if (isset($ing2))
{
fwrite($file,'$ing2');fwrite($file,'');fwrite($file,'');
}
else {break;}






teammatt3 posted this at 15:16 — 7th August 2008.
He has: 1,902 posts
Joined: Sep 2003
Is $ing1 being assigned from some request variable (GET or POST)? If that's true, then no matter what, $ing1 will always be set. That means isset() will always return true, which is not the behavior you're looking for. You should probably use !empty() or strlen() to determine if a user entered a value.
My Site | Regular Expression Tester