php update on a form button

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
AXEmonster
Forum Commoner
Posts: 34
Joined: Fri Sep 05, 2003 11:27 am
Location: newcastle UK

php update on a form button

Post by AXEmonster »

i am new to this guys

i want to update a field (mysql) using only a button (no form fields) the values will be gathered from a hidden field

how do i write this
matthiasone
Forum Contributor
Posts: 117
Joined: Mon Jul 22, 2002 12:14 pm
Location: Texas, USA
Contact:

Post by matthiasone »

Are you wanting the html form code or the query code?
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Code: Select all

<?php
echo '
<form method="post">
 <input type="submit" name="name" value="Send">
</form>
';

if (isset($_POST['name'])) {
 // you database layer goes here
 mysql_query("update table set field = field+1");
 echo 'Updating something...';
}
?>
AXEmonster
Forum Commoner
Posts: 34
Joined: Fri Sep 05, 2003 11:27 am
Location: newcastle UK

Post by AXEmonster »

basicaly it is to reject a record that i have called say a image of a form. if the form cant be matched to other data manually then the user will reject that image by clicking on the html button and by doing that an "R" will be inserted into the status field of the database

there is a ref number which will be held in a variable (hidden field) so i can use that value in my where clause
Post Reply