Hi, im have this form: <form action="index.php" method="get"> <label for="item"> Video ID:</label> <input name="item" id="item" type="text" size="30"><br> <label for="type">Type:</label> <select id="type" name="type"> <option value="0">Format FLV </option> <option value="13">Format 3GP </option> <option value="18">Format MP4</option> <option value="22">Format MP4 (HD)</option> </select> <label for="btget"> </label> <input name="btget" id="btget" type="submit" class="boton" value="Download Video"> <br> </form> PHP: But i want include other option, but i want if the user select that option use another action, how i can do that?
You would need to use javascript, to change the action based on some criteria, select list, checkbox, etc...
You can also place redirect within your action script depending of option selected in form. Like this: <?php if($_GET["btget"]){ switch($_GET["type"]){ case '0': header("Location: process0.php?item=".urlencode($_GET["item"])); break; case '13': header("Location: process13.php?item=".urlencode($_GET["item"])); break; case '18': header("Location: process18.php?item=".urlencode($_GET["item"])); break; case '22': header("Location: process22.php?item=".urlencode($_GET["item"])); break; } exit; } ?> PHP:
also take note of using sessions <?php session_start(); $_SESSION['prev_data']['get'] = array_merge($_GET,$_POST); if($_GET["btget"]){ switch($_GET["type"]){ case '0': header("Location: process0.php?item=".urlencode($_GET["item"])); break; case '13': header("Location: process13.php?item=".urlencode($_GET["item"])); break; case '18': header("Location: process18.php?item=".urlencode($_GET["item"])); break; case '22': header("Location: process22.php?item=".urlencode($_GET["item"])); break; } exit; } ?>