Forum Moderators: coopster
If ($var == 1)
{
Launch [google.com...] in new window;
}
Else
{
Launch [yahoo.com...] in new window;
}
What would be the proper coding for this?
I know how to do the rest, just don't know what the command for launching a new webpage would be.
Anything would help,
--Ron
The example you put in your post looks good, all you need to do is put the correct code for what you are tryign to do within the {}
I suspect what you are trying to do is present the user with a link and if the variable is 1 then the link goes to google, if not it takes the user to yahoo? If so try somethign liek this...
If ($var == 1)
{
echo"<a href=\"http://www.google.com/\" target=\"_blank\">Link to site</a>";
}
Else
{
echo"<a href=\"http://www.yahoo.com/\" target=\"_blank\">Link to site</a>";
}
Hope this helps.
Mack.
If ($var == 1)
{
header("Location: [someurl.com");...]
}
Else
{
header("Location: [otherurl.com");...]
}
dc
EX:
<form action="process.php" method="post" target="_blank">
<input type="checkbox" name="amazon" />Amazon.com
<input type="checkbox" name="ebay" />eBay
<input type="checkbox" name="half" />Half.com
<input type="checkbox" name="bookbyte" />Bookbyte
<input type="checkbox" name="abe" />Abebooks.com
</form>
And then on the process.php page I want it to launch amazon.com if the amazon checkbox is selected, and if the ebay box is selected, open ebay.com in a new window, etc.
Hope this further explains it. O_O
--Ron
Depending on the selected boxes, the following pages are loaded.
The JS
<script>
function loadPages(theForm)
{
var theElements = theForm.elements;
for (var i = 0; i < theElements.length; i++)
{
if (theElements[i].checked)
window.open('http://' + theElements[i].value);
}
return false;
}
</script>
<form method="post">
<input type="checkbox" name="outlink[1]" value="www.amazon.com" />Amazon.com<br />
<input type="checkbox" name="outlink[2]" value="www.ebay.co.uk" />eBay<br />
<input type="checkbox" name="outlink[3]" value="www.half.com" />Half.com<br />
<input type="checkbox" name="outlink[4]" value="www.bookbyte.com" />Bookbyte<br />
<input type="checkbox" name="outlink[5]" value="www.abe.com" />Abebooks.com<br /><br />
<input type="submit" onClick="return loadPages(this.form);" value="Load Windows">
</form>
Good luck, i hope this is what you have been looking for.
Del