CodeAndCoins Forum

Official Forum of YouTube/CodeAndCoins Channel

Any problem, other than on a youtube video.
User avatar
By akhilesh
#73
sir when I click on submit btn of my register form then instead of saving the data on the database form action that is insert.php opens plz help me
that code (insert.php) is this
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "right";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$sql = "INSERT INTO register (email,password)
VALUES ('varchar', 'text')";

if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>
User avatar
By akhilesh
#75
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "right";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$sql = "INSERT INTO register (email, password)
VALUE ( email', 'password')";

if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>







First of all thanks a lot of your reply. the suggestions you gave me worked but i encountered a new problem that is when any user sign up through my register form then the value given in insert.php page that is the value which is in between of italic tag gets entered but the value given by user does not get entered
.
Sir for your convenience i have posted my resiter.html code here below.
and again thanks a lot for your previous help.
Sir please help me.





<form action="insert.php" method="post">
<div class="container">
<h1>Register</h1>
<p>Please fill in this form to create an account.</p>
<hr>

<label for="email"><b>Email</b></label>
<input type="text" placeholder="email" name="email" required><HR SIZE=11>

<label for="psw"><b>Password</b></label>
<input type="password" placeholder="password" name="password" required><HR SIZE=11>


<p>By creating an account you agree to our <a href="TERS.HTML">Terms & Privacy</a>.</p>
<button type="submit" class="registerbtn">Register</button>
</div>

<div class="container signin">
<p>Already have an account? <a href="log.html">Sign in</a>.</p>
</div>
</form>
User avatar
By shah.nawaraj.forum
#76
In that reply i also mention a php Playlist. First learn the php and then ask. Here in your code i can see lot of mistake. If i just correct your mistake and you didn't learn, then that's not going to work. I can just show the way. :)

Warning: mysqli::__construct(): (HY000/1045): Acce[…]

How to get the data from Register into Login

Check out this post .

Checking values in a database

Good day, I have an IOT device where I check t[…]

Check out the code from this page .