Reply
if variable
Old 05-02-2004, 04:11 AM if variable
Junior Talker

Posts: 2
I need to send a variable to a php script from html and then have the script output somthing based on what the variable was. I found some code that looks like this:

<?php
if ($var="001") $output="<b>a!</b><br>";
if ($var="002") $output="<b>b!</b><br>";
if ($var="003") $output="<b>c!</b><br>";

print "$output"
?>

But it doesn't work...it just prints the last $output (c!)

Please help ASAP!

Cheers
Chris
cybercampbell is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 05-04-2004, 04:53 AM
Skilled Talker

Posts: 53
<?
if ($var == "001") { $output="a!";
} elseif ($var == "002") { $output="b!";
} elseif ($var == "003") { $output="c!"; }
print "<b>$output</b><br>";
?>

We could take this further talking about quotes and alpha/numeric variables but I used the sample you provided.

Jim Webster
http://www.iDevDirect.com/
iDevDirect.com is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to if variable
 

Thread Tools

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10942 seconds with 13 queries