...

View Full Version : Need Quick Help! PHP



1337hovie
03-02-2010, 10:56 PM
Ok so i have a table with 3 columns
School info | quantity | down
school1 | 10 | downarrow.gif
school2 | 14 | downarrow.gif
school3 | VL3 | downarrow.gif
school4 | VL4| and so on,
school5 vl5
school6
school7
school8
school9
school10

I need to have the downarrow.gif button subtract 1 from the value(the $VL's are the value), and post a message on another table.

the quantity values are:
VL1
VL2
VL3
VL4
VL5
VL6
VL7
VL8
VL9
VL10

This block of code, i need to be tailored to just the first one, which is VL1. and made into a button. So when it's clicked. that code is ran.


<?php

if ( isset($_GET['action'], $_GET['field']) && $_GET['action'] == 'subtract' ) {

$field = mysql_real_escape_string(urldecode($_GET['field']));

if ( !mysql_query("UPDATE virtual_left SET $field = $field - 1") ) {
echo "problem executing query: " . mysql_error() . "<p />";
}

if ( !mysql_query("INSERT INTO audit (message) VALUES ('school1 -1 apple')") ) {
echo "problem executing query: " . mysql_error() . "<p />";
}

// We are done, redirect..
header("Location: view.php");
}

Once its made into that first VL1. i can copy it, paste it, and tailor each one for the rest of them.

I am just lost on how to put it into a button and where i need to identify LV1, LV2, etc etc.
THANKS
jt



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum