I’m trying to retrieve information from database with submit buttons , which have the same name . I’m giving value which is id of the row , so I could make a different actions, but I can not make up my mind how to do that .
When trying like this for example
<form name="form" action="index.php" method="post">
<input type="image" name="x" value="1">
<input type="image" name="x" value="2">
</form>
and php =>
<?php
if (isset($_POST['x'])){
echo $_POST['x'];
}
?>
in chrome it works fine , but in other browsers it doesn’t , any ideas ? thanks
UPDATE
if ($r = $con->query("SELECT * FROM table")){
if ($row = $r->fetch_assoc()){
echo "<input type='image' name='submit' value='" . $row['id'] . "'>";
// and other data which I need to
}
$r->free();
}
I meant like this
HTML
JavaScript
PHP
http://jsfiddle.net/qLubz/
Just change
type="text"totype="hidden"when ready to deploy.Alternatively with no JavaScript: