This is my basic form:
<form class="table" action="signup.php" method="POST">
<input type="text" name="Name" value="" placeholder="Enter Ur name"><br>``
<input type="text" name="username" value="" placeholder="Enter Username" minlength="10" required><br>
<input type="password" name="pwd" value="" placeholder="Enter password" minlength="8" required><br>
<input type="date" name="dob" value="" placeholder="Enter DOB" required><br>
<input type="hidden" name="form_submitted" value="1"/>
<input type="submit" value="signup" name="submit" />
Then I connect to the database with connect.php then my signup.php code looks like this:
include ('connect.php');
$submit=filter_input(INPUT_POST, submit);
if(isset($submit))
{
$name=filter_input(INPUT_POST, Name);
echo "Your name is". $name;
$uname=filter_input(INPUT_POST, username);
$pwd=filter_input(INPUT_POST, pwd);
$dob=filter_input(INPUT_POST, dob);
$query="insert INTO form1(Name,uname,Password,DOB) values('$name','$uname','$pwd','$dob')";
if(mysql_query($query))
{
echo "Information saved successfully";
}
Now if I want to use $name=$_POST['Name'] it is showing you can't access superglobal directly so I use filter input.
After using filter_input it showing undefined constant error for Name,pwd,uname,and dob. So I think and go for is my form submitted because it doesn't know what is Name,pwd,dob,uname.So then please reply with your answers and help me. Finally i need to store the values in database is my motive.