I have a POST called
name='update_name".$id."'
This ID comes from an Foreach.
And i dont know how to call this POST because there is an variable inside.
I'm using MVC, i created the function inside the model, and i'm calling the function inside view:
But i dont know how to call the variable.
I want my script to read the name like this:
$variable = $_POST['update_name1'];
How can i do that?
Same way as setting the tame of your input
$variable = $_POST['update_name'.$i];
Bud i recomend you to use name attribute as array
HTML
<input type="text" name="update_name[]" />
<input type="text" name="update_name[]" />
PHP
<?
foreach ($_POST[update_name] as $item){
// $item `s are now values from input
}
?>
<input name="update_name<?php echo $id; ?>" value="">
您可以将其读取为:
$variable = $_POST['update_name'.$i];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.