PHP/MySQL png image overlay
Posted: Thu Apr 14, 2011 7:54 pm
Hello!
I'm trying to create an script that updates an image that is displayed. Overlaying a "Sold" graphic, whenever the customer checks the "Sold" checkbox, on the update form.
Can I create a blank "sold" column in a table that can be used with a 1/0 IF statement. If the checkbox is checked, it tells the dynamic site to overlay the png file? If not, it doesn't do anything.
This is the update form.
Here is item_change_record.php:
I'm assuming I would use an IF statement here,
to update a $ud_sold to equal 1, if the checkbox was checked?
I know this isn't very well articulated. Thank you ahead of time. Let me know if you need more information.
I'm trying to create an script that updates an image that is displayed. Overlaying a "Sold" graphic, whenever the customer checks the "Sold" checkbox, on the update form.
Can I create a blank "sold" column in a table that can be used with a 1/0 IF statement. If the checkbox is checked, it tells the dynamic site to overlay the png file? If not, it doesn't do anything.
Code: Select all
<?
$id=$_POST['id'];
$db="DB_name";
$link = mysql_connect('nwtillers', 'un', 'pw');
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$query=" SELECT * FROM used_equip WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_num_rows($result);
$i=0;
while ($i < $num) {
$model=mysql_result($result,$i,"model");
$serial=mysql_result($result,$i,"serial");
$application=mysql_result($result,$i,"application");
?>
<table width="600" cellpadding="10" cellspacing="0" border="2">
<tr align="center" valign="top">
<td align="center" colspan="1" rowspan="1" bgcolor="#64b1ff">
<h3>Edit and Submit</h3>
<form action="item_change_record.php" method="post">
<input type="hidden" name="ud_id" value="<? echo "$id" ?>">
Model #:<input type="text" name="ud_model" value="<? echo "$model"?>"><br />
Serial #: <input type="text" name="ud_serial" value="<? echo "$serial"?>"><br >
Application: <input type="text" name="ud_application" value="<? echo "$application"?>"><br />
<br>
<input type="checkbox" name="ud_sold" value="? idk" /> Item Sold<br />
<input type="Submit" value="Update">
</form>
<form action="item_remove.php" method="post">
<input type="Submit" value="Delete Item">
</form>
</td></tr></table>
<?
++$i;
}
?>Here is item_change_record.php:
Code: Select all
<html><head><title></title></head>
<body>
<?
$ud_id=$_POST['ud_id'];
$ud_model=$_POST['ud_model'];
$ud_application=$_POST['ud_serial'];
$ud_application=$_POST['ud_application'];
$db="DB_name";
$link = mysql_connect("nwtwillers", "un", "pw");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
mysql_query(" UPDATE used_equip SET firstname='$ud_model' , lastname='$ud_serial' , birthday='$ud_application' WHERE id='$ud_id'");
echo "Record Updated.";
mysql_close($link);
?>
</body>
</html>to update a $ud_sold to equal 1, if the checkbox was checked?
I know this isn't very well articulated. Thank you ahead of time. Let me know if you need more information.