I have this code in HTML:
<input type ="text" name="<?php echo $id_global;?>"</input>
Then after submitting the form, I am trying something like this, but it's not working:
$id_s = $_POST['$id_global'];
You need to remove the quotes,
try $id_s=$_POST[$id_global];
$id_global variable still contain a value after you have posted?Try with double quotes php will not consider variable between single quotes and try with this also :
<?php
$id_global = 'field_name';
?>
<form action="/Stackoverflow/index.php" name="testForm" method="POST">
<input type ="text" name="<?php echo $id_global;?>" />
</form>
<?php
if($_POST){
echo '<pre>';
print_r($_POST[$id_global]);
}
?>
Edit the action as per your need
print_r($_POST);to find it