Re: Optional form variables (IDEA?)

From: Date: Fri, 04 Jul 2003 09:08:01 +0000
Subject: Re: Optional form variables (IDEA?)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-153979@lists.php.net to get a copy of this message
In article <2DB95658DE55D6119D750002559C20101268B6@manilarpcumbx1.rsc- manila-usia.gov>, jmiranda@pd.state.gov says... > Hello, im doing a form that when you pass it will generate a preview report. > My problem is some fields are optional the optional fields are 5. And for > those fields I need to make it fit when it generate what idea or codes can > you suggest? > > Ex, a businesscard preview form. When it generates it will show you a > businesscard template. But how about those un-filled fields. > > Can this be done thru if and else statement? > If I correctly understand your problem, you need to test if a variable has been set, and if so echo its value? if(isset($value)) {echo $value;} You may need to substitute $value with $_POST{'value'} or $_GET{'value} depending on whether you have register_globals set off and whether you are using GET or POST to pass the value. -- Quod subigo farinam $email =~ s/oz$/au/o;

« previous php.general (#153979) next »