Hi There,
I am new to PHP and I am doing some school work and facing some issues. I am not able to add data from my register.php into my DB which is hosted in xampp. and the funny thing is that the register.php keeps refreshing. Kinly please help. Not sure where is there error.
This my code:
Register.php:
[php]<?php
include(“config.php”);
$title=$_REQUEST[‘sel1’];
$fname=$_REQUEST[‘t1’];
$lname=$_REQUEST[‘t2’];
$gen=$_REQUEST[‘r1’];
$id=$_REQUEST[‘t3’];
$pass=$_REQUEST[‘p1’];
$phone=$_REQUEST[‘t5’];
$add=$_REQUEST[‘t6’];
$city=$_REQUEST[‘t7’];
$coun=$_REQUEST[‘t8’];
$dob=$_REQUEST[‘t9’];
if(isset($_post[“sub”]))
{
$sel=mysqli_query("select id from register where id=’$id’ ");
$arr=mysqli_fetch_array($sel);
if($arr[‘id’]!=$id)
{
if(mysqli_query(“insert into register values(’$title’,’$fname’,’$lname’,’$gen’,’$id’,’$pass’,’$phone’,’$add’,’$city’,’$coun’,’$dob’)”))
{
echo "<script>location.href='index.php?con=13 & wel=$id'</script>";
}
}
else
{
echo “user already exists”;
}
}
?>
Register Yourself
Title: |
Mr. Ms. Mrs. |
First Name: |
|
Last name: |
|
Gender: |
Male Female |
Enter Email : |
|
Choose a Password: |
|
Phone no: |
|
Address: |
|
City: |
|
Country: |
|
Date of Birth: |
|
|
|
config.php:
<?php mysqli_connect("localhost","root",""); mysqli_select_db("shop"); ?>[/php]thank you