mardi 3 mars 2015

Cant get $_POST values from multiple forms

i got a bit of a problem, as you guys can see in my code, i got a foreach looping through my img folder, showing all the images, well i left out the proper styling of the images, since the problem is the form inside every image.


i need to get the value from the radio input, so i can tell my other script to select all the info from the DB where the ID has the same value as the input.


and i needed a if statement so that if nothing is set i can show something saying you need to select a radio before you can listen to any stations.


but my if statement keeps showing 'error', even tho i click on the buttons


i hope anyone could help me out :)



if(isset($_POST['submitRadio')):
$test = $_POST['radio'];
echo $test;
else:
echo 'error';
endif;

foreach(glob('img/radios/big/*.png') as path):
printf('
<form method="post">
<input class="hidden" type="text" name="radio" value="1">
<input type="submit" name="submitRadio" value="Go!">
</form>
');
endforeach;

Aucun commentaire:

Enregistrer un commentaire