After 14 day’s of suspend of my account I have learnt bit about forum and really I was per day check my account to access but…
In 14 day’s I tried to connect form submission with php database but it was not successful.
I am not master piece of this path. I means in developing but it my dream to create a simple login and signUp page.
Currently I am using FTP to upload my website where my hosting provider is 000webhost with free domain.
I watch too many youtube video for how to connect database but time I get unsuccessful.
Hope you all developer might you will help me.
Why I create this account? Because as you Know I am not Developer and I have not much money to hire a developer.
Here I thinks you all my teacher who help me as like student. You have all sea of knowledge about this code world and where I can create a login page in days you can do this in 15 minutes. Right…?
Let’s in topic…
I am not able to add form submission to my database.
Where I write down this code from youtube.
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<style type="text/css">
</style>
<script>
// script needed before the DOM is loaded here
</script>
</head>
<body>
<form method="post" action="">
<table border="02" bgcolor="lightyellow">
<tr><td>Name:</td><td><input type="text" name="Name" ></td></tr>
<tr><td>DOB:</td><td><input type="text" name="DOB" ></td></tr>
<tr><td>Mobile Number:</td><td><input type="text" name="Mobile_Number" ></td></tr>
<tr><td>Email Address:</td><td><input type="text" name="Email_ID" ></td></tr>
<tr><td align="center" colspan="2"><input type="submit" name="Submit" value="Submit" ></td></tr>
</table>
</form>
<script>
// script that needs the DOM to be loaded here
</script>
</body>
</html>
<?php define('DB_HOST', 'localhost'); define('DB_NAME', 'id4915357_registration'); define('DB_USER','id4915357_registration'); define('DB_PASSWORD','Demo@123'); $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error()); $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error()); function NewUser() { $Name = $_POST['name']; $DOB = $_POST['DOB']; $Email_ID = $_POST['Email_ID']; $Mobile_Number = $_POST['Mobile_Number']; $query = "INSERT INTO websiteusers (Name,DOB,Email_ID,Mobile_Number) VALUES ('$Name','$DOB','$Email_ID','$Mobile_Number')"; $data = mysql_query ($query)or die(mysql_error()); if($data) { echo "YOUR REGISTRATION IS COMPLETED..."; } } function SignUp() { if(!empty($_POST['Mobile_Number'])) //checking the 'Mobile_Number' name which is from Sign-Up.html, is it empty or have some text { $query = mysql_query("SELECT * FROM websiteusers WHERE userName = '$_POST[Mobile_Number]' AND Email_ID = '$_POST[Email_ID]'") or die(mysql_error()); if(!$row = mysql_fetch_array($query) or die(mysql_error())) { newuser(); } else { echo "SORRY...YOU ARE ALREADY REGISTERED USER..."; } } } if(isset($_POST['submit'])) { SignUp(); } ?>
Where is my mistake…
Permitting to access this url https://databases.000webhost.com with UserID and password mention in code.
Demo url: https://mysoftweb2sms.000webhostapp.com/SIGNUP.PHP
No error show also.**