Jump to content

hidden type


etsted

Recommended Posts

the function at the bottom is supposed to store both the value and name of the choosen argument, but only stores the name

 

<body> <form action="hovedrett.php" method="post"> <select name="frett"> <option>rekkeplatte</option> <option>friske reker</option> </select> <br> <input type="submit" name="knapp" value="Neste"> </form> <?php $forrett = $_POST['frett']; function bevare($mat) { foreach($mat as $indeks => $verdi) { if( !strstr($indeks, "knapp")) { echo "<input type='hidden' name='$verdi' value='$indeks'> "; } // if } // foreach } bevare($forrett); ?></body>

Link to comment
Share on other sites

read the manual on foreach then

http://www.w3schools.com/Php/php_looping_for.asp

http://www.php.net/manual/en/control-structures.foreach.php

 

you need to pass it an array. You are just passing it a string (the value of the selected <option> tag).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...