I had no problems with it until i added some javascript methods of date entry on the 2 dates represented by variables $joindate and $birthdate.
After running this page and checking inside php myadmin, all variables go into the database except these 2. It must have something to do with them using javascript. The strange thing is that the variables do hold values, as when i echo them out in the table on the page, they show the correct values that i put in the form.
So my question is why does this happen, and how to make the database accept the variables??
<?php
include('header.php');
include('auth.php');
?>
<div id="content">
<div id="logbox">
<b>You are logged in as: <font color=#00CC00><?php echo $_SESSION['myusername'];?></font></b>
</div>
<div id="contentleft">
<h2>Added Succesfully!</h2>
<?php
$chinesename = $_POST['chinesename'];
$englishname = $_POST['englishname'];
$gender = $_POST['gender'];
$courseconsultant = $_POST['courseconsultant'];
$phonenumber = $_POST['phonenumber'];
$email = $_POST['email'];
$source = $_POST['source'];
$birthday = $_POST['birthday'];
$joindate = $_POST['joindate'];
$notes = $_POST['notes'];
$image = $_FILES['file']['name'];
$tmp_name = $_FILES['file']['tmp_name'];
include ('connect.php');
mysql_query("set names utf8");
$query = "INSERT INTO students(STU_ID,STU_Chinese_Name,STU_English_Name,STU_Gender,STU_Course_Consultant,STU_Phone_Number,STU_Email,STU_Source,STU_Notes,STU_Picture,STU_Birthday,STU_joindate) VALUES ('NULL','$chinesename','$englishname','$gender','$courseconsultant','$phonenumber','$email','$source','$notes','$image','$birthday','$joindate')";
mysql_query($query) or die ('Error updating database');
?>
<html>
<body>
<p>The following student profile has been entered into the database:</p>
<table class ="gridtable">
<tr>
<td>Chinese Name
<td><font color=#00CC00><?php echo $chinesename;?></td></font>
</tr>
<tr>
<td>English Name</td>
<td><font color=#00CC00><?php echo $englishname;?></td></font></font>
</tr>
<tr>
<td>Gender</td>
<td><font color=#00CC00><?php echo $gender;?></td></font>
</tr>
<tr>
<td>Course Consultant</td>
<td><font color=#00CC00><?php echo $courseconsultant;?></td></font>
</tr>
<tr>
<td>Phone Number</td>
<td><font color=#00CC00><?php echo $phonenumber;?></td></font>
</tr>
<tr>
<td>Email</td>
<td><font color=#00CC00><?php echo $email;?></td></font>
</tr>
<tr>
<td>Source</td>
<td><font color=#00CC00><?php echo $source;?></td></font>
</tr>
<tr>
<td>Birthday</td>
<td><font color=#00CC00><?php echo $birthday;?></td></font>
</tr>
<tr>
<td>Join Date</td>
<td><font color=#00CC00><?php echo $joindate;?></td></font>
</tr>
<tr>
<td>Notes</td>
<td><font color=#00CC00><?php echo $notes;?></td></font>
</tr>
<tr>
<td>Image</td>
<td><font color=#00CC00><?php echo $image;?></td></font>
</tr>
</table>
</br>
<fieldset>
<h2>What do you want to do next?</h2>
<br>
<a href="menu_addinfo.php">Add another student</a><br>
<a href="form_addstudent.php">Delete this record</a><br>
<a href="form_addstudent.php">Add a transaction</a><br>
</fieldset>
</div>
<?php include('sidebar.php'); ?>
</div>
<?php include('footer.php'); ?>

New Topic/Question
Reply



MultiQuote





|