Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Let the script decides which part to read ????

Status
Not open for further replies.

joep

Programmer
Jun 4, 2000
15
NL
Hello,<br>I hav written 3 scripts. All with a little bit of other output.<br>What i want to do is let the script decides which piece it has to read. (you know, if/ else etc.) The 'problem' is that the script has to 'look' to the value of an ENUM (i've got an ENUM with three choices) and then decides which part to read. Even if the ENUM isn't selected.<br>I will try to describe a example:<br>1.Searchform:<br>- two checkboxes (values: 'y','n')<br>- one ENUM with name: work(values: self, employee, nowork)<br><br>2. Output form:<br>With the following results displayed:<br>if($work = 'self'){<br>Privat address:<br>Business address:<br>Married:<br>Children:<br><br>}else if($work = 'employee'){<br>Privat address:<br>Boss' address:<br>Married:<br>Children:<br><br>}else if($work = 'nowork'){<br>Privat address:<br>Married:<br>Children:<br>}<br><br>As you can see, the output has to be different of which 'persons' are selected. (but even if the ENUM option isn't selected in the searchfield.)<br>Who can help me?<br><br>Joep van Schaik<br>
 
I am unsure if I catch exactly what you are trying to get at, but from looking at the logic in your sample script, you will need to make some assumptions and even guesses as to what the right choice will be.<br><br>Add a conditional statement (if):<br><br>if(!$work)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($businessaddress)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($privateaddress == $businessaddress)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$work = &quot;self&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($bossaddress)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($privateaddress != $bossaddress)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$work = &quot;employee&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$work = &quot;self&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if((!$bossaddress)&&(!$businessaddress))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$work = &quot;nowork&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><br>Sincerely,<br>Chad.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top