Hello. First time poster, long time reader here……..
I run an online tutoring company and I’m trying to build a simple (hopefully) mod that will work with my OsCommerce site where I can update/display tutoring time that a customer has left and also comments left by the tutor.
I’m thinking that all I need is a tutoring_time column in the customers database, then a separate database for the comments (so that they can be time stamped and listed as separate entries in a table). I would like to create a page that…..
1.) Lists all customers
2.) Allows me to select via radio button a customer’s account to edit.
Below is the VERY EARLY stages of what I have. Basically it’s the page that has the form and the page that processes the form. BTW, nevermind some of the field names. I’ll be changing those at some point.
Can anyone help me with the radio button selecting the customer part?
Thanks!
The form page….
[code=php]
<?php
include(“dbinfo.inc_current.php”);
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( “Unable to select database”);
$query=”SELECT * FROM tutoringunits”;
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,”id”);
$first=mysql_result($result,$i,”first”);
$units=mysql_result($result,$i,”units”);
$web=mysql_result($result,$i,”web”);
$date_time=mysql_result($result,$i,”date_added”);
?>
<html>
<form action=”updated.php”>
<input type=”hidden” name=”ud_id” value=”<? echo “$id”; ?>”>
ID Number: <input type=”text” name=”ud_id” value=”<? echo “$id”?>”><br>
First Name: <input type=”text” name=”ud_first” value=”<? echo “$first”?>”><br>
Units: <input type=”text” name=”ud_units” value=”<? echo “$units”?>”><br>
Web Address: <input type=”text” name=”ud_web” value=”<? echo “$web”?>”><br>
Date/Time Stamp (all times PST): <input type=”text” name=”ud_web” value=”<? echo “$date_time”?>”><br>
Update ID: <input type=”text” name=”ud_update_id” value=””><br>
ID2: <input type=”text” name=”ud_id2″ value=””><br>
Comments: <input type=”text” name=”ud_comments” value=””><br>
<input type=”Submit” value=”Update”>
</form>
</html>
<?php
++$i;
}
?>
Processing the info. from the form….
[code=php]
<?
include(“dbinfo.inc.php”);
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( “Unable to select database”);
$query=”UPDATE tutoringunits SET first=’$ud_first’, units=’$ud_units’, web=’$ud_web’ WHERE id=’$ud_id'”;
@mysql_select_db($database) or die( “Unable to select database”);
mysql_query($query);
$query2 = “INSERT INTO comments VALUES (”,’$ud_id2′,Now(),’$ud_comments’)”;
@mysql_select_db($database) or die( “Unable to select database”);
mysql_query($query2);
echo “Record Updated”;
mysql_close();
?>