My Submit login wont store

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
phazorRise
Forum Contributor
Posts: 134
Joined: Mon Dec 27, 2010 7:58 am

Re: My Submit login wont store

Post by phazorRise »

cancel button code is also wrong

<input type="reset" name="Cancel"
value="Exit">
oyedele
Forum Newbie
Posts: 17
Joined: Mon Jun 27, 2011 6:59 am

Re: My Submit login wont store

Post by oyedele »

Thanks..Done that bt am now having issue like dis below;
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Address, Phone Number) VALUES('Mr', '07283063', 'femimif', 'femimi','oyedele','o' at line 1
Sorry if i distract u a lot today..


Error Extracted from:
<?php
include('dbconnect.php');
$Title =$_POST['Title'];
$MatricNo =$_POST['MatricNo'];
$Password =$_POST['Password'];
$RPassword = $_POST['RPassword'];
$Surname =$_POST['Surname'];
$Firstname =$_POST['Firstname'];
$Lastname =$_POST['Lastname'];
$State=$_POST['State'];
$Sex =$_POST['Sex'];
$Department =$_POST['Department'];
$Level =$_POST['Level'];
$EmailAddress =$_POST['EmailAddress'];
$PhoneNumber =$_POST['PhoneNumber'];

if(isset($_POST['Register']))
{
$sql= "INSERT into student_details(Title, MatricNo, Password, RPassword, Surname, Firstname , Lastname ,State, Sex, Department, Level, Email Address, Phone Number) VALUES('$Title', '$MatricNo', '$Password', '$RPassword','$Surname','$Firstname','$Lastname','$State', '$Sex', '$Department','$Level','$EmailAddress', '$PhoneNumber')" ;
}
mysql_query($sql) or die (mysql_error());

echo "You have successfully registered";

?>
oyedele
Forum Newbie
Posts: 17
Joined: Mon Jun 27, 2011 6:59 am

Re: My Submit login wont store

Post by oyedele »

Okay...I hope u will help me with lot more and will keep feeding u back...Thanks
User avatar
phazorRise
Forum Contributor
Posts: 134
Joined: Mon Dec 27, 2010 7:58 am

Re: My Submit login wont store

Post by phazorRise »

Column names should be single quoted. And it's good practice to check for magic quotes and according to that add or strip slashes from user input.
Character type values be quoted not numbers. Plus, I wouldn't give a column name containing blank space like "Email Address". Instead i would use "Email_address". You can also use http://php.net/manual/en/function.mysql-real-escape-string.php to make query more safer.

if you have phpmyadmin installed and configured then you can practice working with query's and it can generate php code for each operation.
So you can see what mistakes you are making.
oyedele
Forum Newbie
Posts: 17
Joined: Mon Jun 27, 2011 6:59 am

Re: My Submit login wont store

Post by oyedele »

I really appreciate our tutorials phazorRise...Thanks very much still working on it..
oyedele
Forum Newbie
Posts: 17
Joined: Mon Jun 27, 2011 6:59 am

Re: My Submit login wont store

Post by oyedele »

I really appreciate ur contributions. I have been able to sort it out. Thanks very much...


How can a generate a php code to create and admin page where the admin will be able to search the names of registered students?
Post Reply