EmC
2010-06-02, 19:27
I'll start by saying that I have been working with php and mysql for exactly 13 hours at this point.
I am trying to write a couple of pages that will allows my band students to register via the web on the first day of camp. Basic stuff like name, grade, instrument, etc. I have the basics down. I am sure my code is horrible and their are much better ways to go about what I am doing, but I have just been using some tutorials from here and there. I keep running into formatting issues and other things that I can't seem to resolve because one tutorial writes something differently than the another.
Here is what I can do already.
- Register a new user and insert the record into the DB. here (http://hchscarlsen.com/Database/data_entry.php)
(feel free to enter some fake data, it would make my life easier)
- Look up the user by last name then link to their specific record to attempt to update it. here (http://hchscarlsen.com/Database/admin_index.php)
(there are currently only two records one with a last name of 'last' and another with 'Doe')
Here is where I encounter an issue. All of the information is there and I can change it. When I click submit all of the changed data is passed, the only thing not happening is an actual update in the database and I am getting really frustrated. AGHHHH!
Here is my code for the update.php action on the button.
<?
require('/home1/hchscarl/unpw/unpw.php');
$id=$_POST['id'];
$last=$_POST['last'];
$first=$_POST['first'];
$dob=$_POST['dob'];
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$shirt=$_POST['shirt'];
$guard1=$_POST['guard1'];
$guard1phone=$_POST['guard1phone'];
$guard1email=$_POST['guard1email'];
$guard1occ=$_POST['guard1occ'];
$guard2=$_POST['guard2'];
$guard2phone=$_POST['guard2phone'];
$guard2email=$_POST['guard2email'];
$guard2occ=$_POST['guard2occ'];
$instrument=$_POST['instrument'];
$brand=$_POST['brand'];
$model=$_POST['model'];
$serial=$_POST['serial'];
$con1=$_POST['con1'];
$con2=$_POST['con2'];
$com1=$_POST['com1'];
$com2=$_POST['com2'];
$grade=$_POST['grade'];
print $id;
print $last;
print $first;
print $dob;
print $address;
print $city;
print $state;
print $zip;
print $phone;
print $email;
print $shirt;
print $guard1;
print $guard1phone;
print $guard1email;
print $guard1occ;
print $guard2;
print $guard2phone;
print $guard2email;
print $guard2occ;
print $instrument;
print $brand;
print $model;
print $serial;
print $con1;
print $con2;
print $com1;
print $com2;
print $grade;
$query = "UPDATE info SET last='$last',first='$first', dob='$dob', address='$address', city='$city', state='$state', zip='$zip', phone='$phone', email='$email', shirt='$shirt', guard1='$guard1', guard1phone='$guard1phone', guard1email='$guard1email', guard1occ='$guard1occ',
guard2='$guard2', guard2phone='$guard2phone', guard2email='$guard2email', guard2occ='$guard2occ', instrument='$instrument', brand='$brand', model='$model', serial='$serial', con1='$con1', con2='$con2', com1='$com1', com2='$com2', grade='$grade WHERE id=$id";
mysql_query($query);
mysql_close();
?>
Basically what gives?:lol:
I am trying to write a couple of pages that will allows my band students to register via the web on the first day of camp. Basic stuff like name, grade, instrument, etc. I have the basics down. I am sure my code is horrible and their are much better ways to go about what I am doing, but I have just been using some tutorials from here and there. I keep running into formatting issues and other things that I can't seem to resolve because one tutorial writes something differently than the another.
Here is what I can do already.
- Register a new user and insert the record into the DB. here (http://hchscarlsen.com/Database/data_entry.php)
(feel free to enter some fake data, it would make my life easier)
- Look up the user by last name then link to their specific record to attempt to update it. here (http://hchscarlsen.com/Database/admin_index.php)
(there are currently only two records one with a last name of 'last' and another with 'Doe')
Here is where I encounter an issue. All of the information is there and I can change it. When I click submit all of the changed data is passed, the only thing not happening is an actual update in the database and I am getting really frustrated. AGHHHH!
Here is my code for the update.php action on the button.
<?
require('/home1/hchscarl/unpw/unpw.php');
$id=$_POST['id'];
$last=$_POST['last'];
$first=$_POST['first'];
$dob=$_POST['dob'];
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$shirt=$_POST['shirt'];
$guard1=$_POST['guard1'];
$guard1phone=$_POST['guard1phone'];
$guard1email=$_POST['guard1email'];
$guard1occ=$_POST['guard1occ'];
$guard2=$_POST['guard2'];
$guard2phone=$_POST['guard2phone'];
$guard2email=$_POST['guard2email'];
$guard2occ=$_POST['guard2occ'];
$instrument=$_POST['instrument'];
$brand=$_POST['brand'];
$model=$_POST['model'];
$serial=$_POST['serial'];
$con1=$_POST['con1'];
$con2=$_POST['con2'];
$com1=$_POST['com1'];
$com2=$_POST['com2'];
$grade=$_POST['grade'];
print $id;
print $last;
print $first;
print $dob;
print $address;
print $city;
print $state;
print $zip;
print $phone;
print $email;
print $shirt;
print $guard1;
print $guard1phone;
print $guard1email;
print $guard1occ;
print $guard2;
print $guard2phone;
print $guard2email;
print $guard2occ;
print $instrument;
print $brand;
print $model;
print $serial;
print $con1;
print $con2;
print $com1;
print $com2;
print $grade;
$query = "UPDATE info SET last='$last',first='$first', dob='$dob', address='$address', city='$city', state='$state', zip='$zip', phone='$phone', email='$email', shirt='$shirt', guard1='$guard1', guard1phone='$guard1phone', guard1email='$guard1email', guard1occ='$guard1occ',
guard2='$guard2', guard2phone='$guard2phone', guard2email='$guard2email', guard2occ='$guard2occ', instrument='$instrument', brand='$brand', model='$model', serial='$serial', con1='$con1', con2='$con2', com1='$com1', com2='$com2', grade='$grade WHERE id=$id";
mysql_query($query);
mysql_close();
?>
Basically what gives?:lol: