How do you prevent a form from clearing field data after it has been submitted in php?

|
Elnatal 2021-02-23 11:14:25
ajax
Heydiliuuu 2021-02-23 11:54:56
Hello everyone. I want WordPress plugin like this where can I find this. Instead of get your report I need with download broucher
Heydiliuuu 2021-02-23 11:55:18
codeslide-25954.jpg

ilovetohelppeople 2021-02-23 12:20:21
Heydiliuuu 2021-02-23 11:54:56
Hello everyone. I want WordPress plugin like this where can I find this. Instead of get your report I need with download broucher

Open it with page source and edit name

2021-02-23 13:21:33
sanitizerx 2021-02-23 08:09:50
Hi Developers,
I have a few questions to ask.
1. How do you prevent a form from clearing field data after it has been submitted in php?
2. How do you manage roles in php such that a super admin has access and control to several tasks in the system while other admins can only view data or perform few tasks.

Thank you

We store data in database and also store some information which is helpful for us to define super admin , normal admin or user
And by verifying a visitor as super admin, normal admin or user we print some specific content for admin , for super admin or for users

Rockzz_18 2021-02-23 15:01:49
Hi can anyone help me with css ?
Rockzz_18 2021-02-23 15:02:56
codeslide-25965.jpg
I need to align this img beside the contact
2021-02-23 15:08:18
Rockzz_18 2021-02-23 15:02:56
I need to align this img beside the contact

Use Display:flex property in css

Rockzz_18 2021-02-23 15:09:37
Not working bro
Rockzz_18 2021-02-23 15:10:01
codeslide-25968.jpg

Rockzz_18 2021-02-23 15:10:22
codeslide-25969.jpg

2021-02-23 15:14:50
Rockzz_18 2021-02-23 15:09:37
Not working bro

Check is it a child like other nav items of an element

Rockzz_18 2021-02-23 15:17:51
codeslide-25971.jpg
This is the code img tag
2021-02-23 16:27:56
its very slow
2021-02-23 20:38:15
Is there any possible way to decrypt Coldev Layer in Php
Rk Biswa 2021-02-24 10:09:22
Hi how to insert data through csv on core php
Rk Biswa 2021-02-24 10:10:16
First insert one data into product page then other attribute data will insert next table with first data foreign key
Rk Biswa 2021-02-24 10:10:38
Sorry product table
Rk Biswa 2021-02-24 10:10:53
Then product ‘s attribute table
Rockzz_18 2021-02-24 10:28:09
Hi can anyone help me I’m trying to fetch video url from particular column from table is this query and code is correct I’m getting object not found error
Rockzz_18 2021-02-24 10:28:29
codeslide-26023.jpg

zckryjhn 2021-02-24 10:28:43
Can I have udemy python bootcamp? I am interested on learning python thank you!
Rockzz_18 2021-02-24 10:29:15
codeslide-26025.jpg

Rockzz_18 2021-02-24 10:29:45
codeslide-26026.jpg

ᴍᴀʜᴀᴅ – 2021-02-24 10:31:29
Rockzz_18 2021-02-24 10:29:15

Put it in an array like $img_src[]

Neha Sharma 2021-02-24 11:31:48
Sir basic se php kese sikhe
2021-02-24 11:33:24
Neha Sharma 2021-02-24 11:31:48
Sir basic se php kese sikhe

Mana be sikhe ha

Neha Sharma 2021-02-24 11:33:54
Kese
Neha Sharma 2021-02-24 11:34:06
Start kre
2021-02-24 11:34:59
Neha Sharma 2021-02-24 11:34:06
Start kre

Muja be ne pata ap ko thori nolig ha to muja be bato

Kibira Newton 2021-02-24 11:39:58
<?php

include “init.php”;
$obj = new base_class;
if (isset($_POST[‘signup’])) {
$full_name = $obj->security($_POST[‘full_name’]);
$email = $obj->security($_POST[’email’]);
$password = $obj->security($_POST[‘password’]);
$img_name = $_FILES[‘img’][‘name’];
$img_tmp = $_FILES[‘img’][‘tmp_name’];
$img_path = “assets/img/”;
$extensions = [‘jpg’, ‘jpeg’, ‘png’];
$img_ext = explode(“.”, $img_name);
$img_extension = end($img_ext);

$name_status = $email_status = $password_status = $photo_status = 1;

if (empty($full_name)) {
$name_error = “Full name is required”;
$name_status = “”;
}

if(empty($email))
{
$email_error = “Email is Required”;
$email_status = “”;
}else{

if(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
$email_error = “Invalid email format”;
$email_status = “”;
}else
{

if($obj->Normal_Query(“SELECT email FROM users WHERE email = ?”, array($email))
)
{

if($obj->Count_Rows() == 0)
{

}else
{
$email_error = “Sorry this email Exist”;
$email_status = “”;
}

}

}
}
// password validation
if(empty($password))
{
$password_error = “Password is required”;
$password_status = “”;
}else if(strlen($password) < 5){
$password_error = “Password is too short”;
$password_status = “”;
}
// image validation

if(empty($img_name))
{
$image_error = “Image is required”;
$photo_status = “”;

}else if(!in_array($img_extension, $extensions))
{
$image_error = “Invalid image extension”;
$photo_status = “”;

}

if(!empty($name_status) && !empty($email_status) && !empty($password_status) && !empty($photo_status))
{
move_uploaded_file($img_tmp, “$img_path/$img_name”);
$status = 0;
if($obj->Normal_Query(“INSERT INTO users (name, email, password, image, status) VALUES (?,?,?,?,?)”, [$full_name,
$email, password_hash($password, PASSWORD_DEFAULT), $img_name, $status])){
// $obj->Create_Session(“account_success”, “Account Successfully Created”);
header(location:login.php);
}
}

}

?>

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0, shrink-to-fit=no”>
<title>Create Account</title>
<?php include ‘components/css.php’ ?>
</head>
<body>
<div class=”signup-container”>

<div class=”account-left”>
<div class=”account-text”>
<h1>Lets Chat</h1>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit.
Quod ad omnis rem quidem, porro temporibus culpa velit error,

</p>

</div>
<!– close account-left –>

</div>
<!– close account left –>

<div class=”account-right”>
<?php include ‘components/signupform.php’ ?>

</div>
<!– close account right –>

</div>
<!– close signupcontainer –>

<script type=”text/javascript” src=”assets/js/jquery.js”></script>
<script type=”text/javascript” src=”assets/js/file_label.js”></script>
</body>
</html>

2021-02-24 11:40:25
Kibira Newton 2021-02-24 11:39:58
<?php

include “init.php”;
$obj = new base_class;
if (isset($_POST[‘signup’])) {
$full_name = $obj->security($_POST[‘full_name’]);
$email = $obj->security($_POST[’email’]);
$password = $obj->security($_POST[‘password’]);
$img_name = $_FILES[‘img’][‘name’];
$img_tmp = $_FILES[‘img’][‘tmp_name’];
$img_path = “assets/img/”;
$extensions = [‘jpg’, ‘jpeg’, ‘png’];
$img_ext = explode(“.”, $img_name);
$img_extension = end($img_ext);

$name_status = $email_status = $password_status = $photo_status = 1;

if (empty($full_name)) {
$name_error = “Full name is required”;
$name_status = “”;
}

if(empty($email))
{
$email_error = “Email is Required”;
$email_status = “”;
}else{

if(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
$email_error = “Invalid email format”;
$email_status = “”;
}else
{

if($obj->Normal_Query(“SELECT email FROM users WHERE email = ?”, array($email))
)
{

if($obj->Count_Rows() == 0)
{

}else
{
$email_error = “Sorry this email Exist”;
$email_status = “”;
}

}

}
}
// password validation
if(empty($password))
{
$password_error = “Password is required”;
$password_status = “”;
}else if(strlen($password) < 5){
$password_error = “Password is too short”;
$password_status = “”;
}
// image validation

if(empty($img_name))
{
$image_error = “Image is required”;
$photo_status = “”;

}else if(!in_array($img_extension, $extensions))
{
$image_error = “Invalid image extension”;
$photo_status = “”;

}

if(!empty($name_status) && !empty($email_status) && !empty($password_status) && !empty($photo_status))
{
move_uploaded_file($img_tmp, “$img_path/$img_name”);
$status = 0;
if($obj->Normal_Query(“INSERT INTO users (name, email, password, image, status) VALUES (?,?,?,?,?)”, [$full_name,
$email, password_hash($password, PASSWORD_DEFAULT), $img_name, $status])){
// $obj->Create_Session(“account_success”, “Account Successfully Created”);
header(location:login.php);
}
}

}

?>

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0, shrink-to-fit=no”>
<title>Create Account</title>
<?php include ‘components/css.php’ ?>
</head>
<body>
<div class=”signup-container”>

<div class=”account-left”>
<div class=”account-text”>
<h1>Lets Chat</h1>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit.
Quod ad omnis rem quidem, porro temporibus culpa velit error,

</p>

</div>
<!– close account-left –>

</div>
<!– close account left –>

<div class=”account-right”>
<?php include ‘components/signupform.php’ ?>

</div>
<!– close account right –>

</div>
<!– close signupcontainer –>

<script type=”text/javascript” src=”assets/js/jquery.js”></script>
<script type=”text/javascript” src=”assets/js/file_label.js”></script>
</body>
</html>

Wath

tinkerbell1708 2021-02-24 11:40:34
Kibira Newton 2021-02-24 11:39:58
<?php

include “init.php”;
$obj = new base_class;
if (isset($_POST[‘signup’])) {
$full_name = $obj->security($_POST[‘full_name’]);
$email = $obj->security($_POST[’email’]);
$password = $obj->security($_POST[‘password’]);
$img_name = $_FILES[‘img’][‘name’];
$img_tmp = $_FILES[‘img’][‘tmp_name’];
$img_path = “assets/img/”;
$extensions = [‘jpg’, ‘jpeg’, ‘png’];
$img_ext = explode(“.”, $img_name);
$img_extension = end($img_ext);

$name_status = $email_status = $password_status = $photo_status = 1;

if (empty($full_name)) {
$name_error = “Full name is required”;
$name_status = “”;
}

if(empty($email))
{
$email_error = “Email is Required”;
$email_status = “”;
}else{

if(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
$email_error = “Invalid email format”;
$email_status = “”;
}else
{

if($obj->Normal_Query(“SELECT email FROM users WHERE email = ?”, array($email))
)
{

if($obj->Count_Rows() == 0)
{

}else
{
$email_error = “Sorry this email Exist”;
$email_status = “”;
}

}

}
}
// password validation
if(empty($password))
{
$password_error = “Password is required”;
$password_status = “”;
}else if(strlen($password) < 5){
$password_error = “Password is too short”;
$password_status = “”;
}
// image validation

if(empty($img_name))
{
$image_error = “Image is required”;
$photo_status = “”;

}else if(!in_array($img_extension, $extensions))
{
$image_error = “Invalid image extension”;
$photo_status = “”;

}

if(!empty($name_status) && !empty($email_status) && !empty($password_status) && !empty($photo_status))
{
move_uploaded_file($img_tmp, “$img_path/$img_name”);
$status = 0;
if($obj->Normal_Query(“INSERT INTO users (name, email, password, image, status) VALUES (?,?,?,?,?)”, [$full_name,
$email, password_hash($password, PASSWORD_DEFAULT), $img_name, $status])){
// $obj->Create_Session(“account_success”, “Account Successfully Created”);
header(location:login.php);
}
}

}

?>

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0, shrink-to-fit=no”>
<title>Create Account</title>
<?php include ‘components/css.php’ ?>
</head>
<body>
<div class=”signup-container”>

<div class=”account-left”>
<div class=”account-text”>
<h1>Lets Chat</h1>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit.
Quod ad omnis rem quidem, porro temporibus culpa velit error,

</p>

</div>
<!– close account-left –>

</div>
<!– close account left –>

<div class=”account-right”>
<?php include ‘components/signupform.php’ ?>

</div>
<!– close account right –>

</div>
<!– close signupcontainer –>

<script type=”text/javascript” src=”assets/js/jquery.js”></script>
<script type=”text/javascript” src=”assets/js/file_label.js”></script>
</body>
</html>

What is the issue ?

Kibira Newton 2021-02-24 11:41:52
In this code i have to problems
1. Am trying to check if email exists on the database buts its not working

2. After submitting my page is not being redirected to login.php

Kibira Newton 2021-02-24 11:42:33
Kibira Newton 2021-02-24 11:39:58
<?php

include “init.php”;
$obj = new base_class;
if (isset($_POST[‘signup’])) {
$full_name = $obj->security($_POST[‘full_name’]);
$email = $obj->security($_POST[’email’]);
$password = $obj->security($_POST[‘password’]);
$img_name = $_FILES[‘img’][‘name’];
$img_tmp = $_FILES[‘img’][‘tmp_name’];
$img_path = “assets/img/”;
$extensions = [‘jpg’, ‘jpeg’, ‘png’];
$img_ext = explode(“.”, $img_name);
$img_extension = end($img_ext);

$name_status = $email_status = $password_status = $photo_status = 1;

if (empty($full_name)) {
$name_error = “Full name is required”;
$name_status = “”;
}

if(empty($email))
{
$email_error = “Email is Required”;
$email_status = “”;
}else{

if(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
$email_error = “Invalid email format”;
$email_status = “”;
}else
{

if($obj->Normal_Query(“SELECT email FROM users WHERE email = ?”, array($email))
)
{

if($obj->Count_Rows() == 0)
{

}else
{
$email_error = “Sorry this email Exist”;
$email_status = “”;
}

}

}
}
// password validation
if(empty($password))
{
$password_error = “Password is required”;
$password_status = “”;
}else if(strlen($password) < 5){
$password_error = “Password is too short”;
$password_status = “”;
}
// image validation

if(empty($img_name))
{
$image_error = “Image is required”;
$photo_status = “”;

}else if(!in_array($img_extension, $extensions))
{
$image_error = “Invalid image extension”;
$photo_status = “”;

}

if(!empty($name_status) && !empty($email_status) && !empty($password_status) && !empty($photo_status))
{
move_uploaded_file($img_tmp, “$img_path/$img_name”);
$status = 0;
if($obj->Normal_Query(“INSERT INTO users (name, email, password, image, status) VALUES (?,?,?,?,?)”, [$full_name,
$email, password_hash($password, PASSWORD_DEFAULT), $img_name, $status])){
// $obj->Create_Session(“account_success”, “Account Successfully Created”);
header(location:login.php);
}
}

}

?>

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0, shrink-to-fit=no”>
<title>Create Account</title>
<?php include ‘components/css.php’ ?>
</head>
<body>
<div class=”signup-container”>

<div class=”account-left”>
<div class=”account-text”>
<h1>Lets Chat</h1>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit.
Quod ad omnis rem quidem, porro temporibus culpa velit error,

</p>

</div>
<!– close account-left –>

</div>
<!– close account left –>

<div class=”account-right”>
<?php include ‘components/signupform.php’ ?>

</div>
<!– close account right –>

</div>
<!– close signupcontainer –>

<script type=”text/javascript” src=”assets/js/jquery.js”></script>
<script type=”text/javascript” src=”assets/js/file_label.js”></script>
</body>
</html>

In this code i have to problems
1. Am trying to check if email exists on the database buts its not working

2. After submitting my page is not being redirected to login.php

|