is it possible to put a form input in a button so that when i click it will pass the id to the next page . Current my button is generated by a database i need to put the DeviceId in to a hiddenfield in the button to pass to another page . Thanks
while ( $row = mysql_fetch_object( $fetch ) ) {
$sResults .= '<tr id="'. $row->DeviceID . '">';
$sResults .= '<td>' . $row->DeviceID . '</td>';
$sResults .= '<td>' . $row->Model . '</td>';
$sResults .= '<td>' . $row->manufacturer . '</td>';
$sResults .= '<td>' .'<INPUT TYPE=BUTTON value="Add to My List">'. '</td>';
You can't make this, but you can make a hidden input.
<INPUT TYPE="HIDDEN" NAME="NAMEOFVALUE" VALUE="3">
Add this to your normal form and it will pass this information to ther server, and the visitor of the page can't see this.
You could do it like this:
<form action="url/to/redirect?foo=bar">
<input type="BUTTON" value="Add to My List"/>
</form>
You can either set the action value to pass the parameters you need or add hidden input fields:
<form action="url/to/redirect" method="POST">
<input name"foo1" type="BUTTON" value="bar1"/>
<input name"foo2" type="BUTTON" value="bar2"/>
<input type="BUTTON" value="Add to My List"/>
</form>
While you're at it, you might want to escape the other values, so that you'll avoid XSS attacks [1]
1 - http://www.thegeekstuff.com/2012/02/xss-attack-examples/