Jump to content

Dynamically create $_POST isset checks


ddgrim

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.