Forum Moderators: open
For example:
<select name="redirect"><option value="">Select One</option>
<option value="http://www.site1.com">Choice 1</option>
<option value="http://www.site2.com">Choice 2</option>
</select>
Then they submit the form, and they go to site1 or site2, based on what they pick.
I'm REALLY hoping someone can help, as I'm exasperated trying to figure this out. I've searched and searched and can't find diddly squat. :)
Thanks,
Karen
You actually don't need javascript to do this. You need a block of PHP code that will take the form input and display a redirect (you can use meta redirect or http redirect codes). So something like:
<html>
<head>
<title>...</title>
<?php
if($_REQUEST['redirect']){
print "<meta http-equiv='refresh' content='0; url={$_REQUEST[redirect]}'>";
}
?>
</head>
<body>
...
<form target='' method='POST'>
<select name="redirect"><option value="">Select One</option>
<option value="http://www.site1.com">Choice 1</option>
<option value="http://www.site2.com">Choice 2</option>
</select>
...
</form>
</body>
</html>
So, I add this snippet in the <head> section and that's it? Or should I add that somewhere in the existing PHP script?
<?php
if($_REQUEST['redirect']){
print "<meta http-equiv='refresh' content='0; url={$_REQUEST[redirect]}'>";
}
?>
Karen
**added
So, I tried copy/pasting the above code in the head section, and it didn't work. Perhaps I need to take off the javascript already in place?
Karen
More on iframes:
[cs.tut.fi...]