ddgrim Posted January 24, 2010 Share Posted January 24, 2010 Hello All, I have a list of buttons on my page named 1 2 3 4 5. I am trying to create a isset($_POST['1']) check for each of these buttons, as the real application will have a varying number of buttons from a DB output. The below code is what I have got so far. <?php for ($i=0; $i < 5; $i++){ if(isset($_POST['$i'])){ $posted_num = $_POST['$i']; echo "POSTED NUM -- ".$posted_num; } } ?> Any help would be much appreciated. Grim Link to comment https://forums.phpfreaks.com/topic/189630-dynamically-create-_post-isset-checks/ Share on other sites More sharing options...
jl5501 Posted January 24, 2010 Share Posted January 24, 2010 Your reference to $_POST['$i'] should be $_POST[$i] Link to comment https://forums.phpfreaks.com/topic/189630-dynamically-create-_post-isset-checks/#findComment-1000820 Share on other sites More sharing options...
ddgrim Posted January 24, 2010 Author Share Posted January 24, 2010 Thank you, works a treat now Link to comment https://forums.phpfreaks.com/topic/189630-dynamically-create-_post-isset-checks/#findComment-1000825 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.