how to show a link depending on script variable value
Hi, I'm really new to PHP folks and have this line in a php script and would like to display download links on a page depending on what the variable value of item_name is.
<?=$_POST[item_name]?>
In VB it would be something like this:
VB Code:
link1 = "http://www.mysoftwareco.com/download1.php?"
link2 = "http://www.mysoftwareco.com/download2.php?"
if item_name.Value = "Software1" then
'Show link1 on the page else
Print link1
Elseif item_name.value = "Software2" then
'Show link2 on the page else
Print link2
end if
so is it possible to do this in php?
Thanks in advance
Cheers!
Re: how to show a link depending on script variable value
Try something like this. If your new to PHP i suggest searching this forum for tutorials as people have posted some good links to help begginers.
PHP Code:
<?
$link1 = "http://www.mysoftwareco.com/download1.php?";
$link2 = "http://www.mysoftwareco.com/download2.php?";
if($_POST['item_name'] == "Software1")
{
print $link1;
}
elseif($_POST['item_name'] == "Software2")
{
print $link2;
}
?>