Hi guys,
I''m having a problem. I have created a very simple test database (one table, four fields), problem is i can't get php to write stuff to the database when completing details in a browser.
Below is my code.
Code - a user would need to complete when registering with a school;
------------------------------------------------------------
<?
include('header.inc');
include("mysql_connect");
?>
<h2>Enter a New userinfo1</h2>
<form name=formone method=post action="insertuserinfo1.php">
<table>
<tr height=30 valign=top>
<td align=right><b>Username :</b></td>
<td>
<input type="text" name="usernameField">
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Firstname :</b></td>
<td>
<input type="text" name="firstnameField">
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Lastname :</b></td>
<td>
<input type="text" name="lastnameField">
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Email :</b></td>
<td>
<input type="text" name="emailField">
</td>
</tr>
</table>
<input type=submit name=Submit value="Submit">
<input type=reset name=Submit2 value="Reset">
</form>
<?
include('footer.inc');
?>
----------------------------------------------------------
This form is then sent to insertuserinfo1.php - code below;
----------------------------------------------------------
<?
include('header.inc');
include("mysql_connect");
?>
<?
$query="insert into userinfo1 (username,firstname,lastname,email) VALUES ('$usernameField','$firstnameField','$lastnameField','$emailField')";
$result = MYSQL_QUERY($query);
?>
<H2>New User Created , well done!!</H2>
<table>
<tr height=30>
<td align=right><b>Username :</b></td>
<td><font color=blue><b><? echo $usernameField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Firstname :</b></td>
<td><font color=blue><b><? echo $firstnameField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Lastname :</b></td>
<td><font color=blue><b><? echo $lastnameField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Email :</b></td>
<td><font color=blue><b><? echo $emailField; ?></font></b></td>
</tr>
</table><br><br>
Click <a href="user.php">here</a> to go back to Main Menu
<?
include('footer.inc');
?>
---------------------------------------------------------
Why can I not get it to work? Can anyone help?
I''m having a problem. I have created a very simple test database (one table, four fields), problem is i can't get php to write stuff to the database when completing details in a browser.
Below is my code.
Code - a user would need to complete when registering with a school;
------------------------------------------------------------
<?
include('header.inc');
include("mysql_connect");
?>
<h2>Enter a New userinfo1</h2>
<form name=formone method=post action="insertuserinfo1.php">
<table>
<tr height=30 valign=top>
<td align=right><b>Username :</b></td>
<td>
<input type="text" name="usernameField">
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Firstname :</b></td>
<td>
<input type="text" name="firstnameField">
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Lastname :</b></td>
<td>
<input type="text" name="lastnameField">
</td>
</tr>
<tr height=30 valign=top>
<td align=right><b>Email :</b></td>
<td>
<input type="text" name="emailField">
</td>
</tr>
</table>
<input type=submit name=Submit value="Submit">
<input type=reset name=Submit2 value="Reset">
</form>
<?
include('footer.inc');
?>
----------------------------------------------------------
This form is then sent to insertuserinfo1.php - code below;
----------------------------------------------------------
<?
include('header.inc');
include("mysql_connect");
?>
<?
$query="insert into userinfo1 (username,firstname,lastname,email) VALUES ('$usernameField','$firstnameField','$lastnameField','$emailField')";
$result = MYSQL_QUERY($query);
?>
<H2>New User Created , well done!!</H2>
<table>
<tr height=30>
<td align=right><b>Username :</b></td>
<td><font color=blue><b><? echo $usernameField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Firstname :</b></td>
<td><font color=blue><b><? echo $firstnameField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Lastname :</b></td>
<td><font color=blue><b><? echo $lastnameField; ?></font></b></td>
</tr>
<tr height=30>
<td align=right><b>Email :</b></td>
<td><font color=blue><b><? echo $emailField; ?></font></b></td>
</tr>
</table><br><br>
Click <a href="user.php">here</a> to go back to Main Menu
<?
include('footer.inc');
?>
---------------------------------------------------------
Why can I not get it to work? Can anyone help?