Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Better way of mapping _POST parameters to variables

I am sure that there is a better way of mapping all the _POST parameters to variables with the same name. Does anybody know how to do this better?

$ownerName = $_POST["ownerName"];
$ownerEmail = $_POST["ownerEmail"];
$ownerPhone = $_POST["ownerPhone"];
$ownerAddress = $_POST["ownerAddress"];
$buyerName = $_POST["buyerName"];
$buyerEmail = $_POST["buyerEmail"];
$buyerPhone = $_POST["buyerPhone"];
$buyerAddress = $_POST["buyerAddress"];
$propertyAddress = $_POST["propertyAddress"];
$parcelNumber = $_POST["parcelNumber"];

Thanks so much.

like image 270
Isaac Lewis Avatar asked Dec 06 '25 10:12

Isaac Lewis


1 Answers

There's a function in PHP to extract the values to vars:

<?php
extract($_POST, EXTR_SKIP);
?>
like image 116
SERPRO Avatar answered Dec 08 '25 17:12

SERPRO



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!