MySQL Forums
Forum List  »  Newbie

Re: DB Not Updating
Posted by: danish hafeez
Date: March 22, 2024 02:58AM

Ensure HTML form input name matches PHP script variable:

<input id="element_15" name="propertypin" class="element text medium" type="text" maxlength="18" />

Validate and process the propertypin value before insertion:

$propertypin = $_POST['propertypin'];
if (!empty($propertypin)) {
$propertypin = mysqli_real_escape_string($conn, $propertypin);
mysqli_query($conn, "INSERT INTO `orderform` (propertypin) VALUES ('$propertypin')");

Use prepared statements to prevent SQL injection:

$propertypin = $_POST['propertypin'];
if (!empty($propertypin)) {
$stmt = $pdo->prepare("INSERT INTO `orderform` (propertypin) VALUES (:propertypin)");
$stmt->bindParam(':propertypin', $propertypin);

Best regard
Danish hafeez | QA Assistant

Options: ReplyQuote

Written By
March 21, 2024 04:57PM
March 21, 2024 10:43PM
March 22, 2024 07:45AM
March 22, 2024 09:02PM
Re: DB Not Updating
March 22, 2024 02:58AM
March 22, 2024 11:47AM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.