0

Is there a more efficient way of doing this? I am simply catching and assigning vars to a lot of $POST vars. this seem monotonous to me..lol any advise is greatly appreciated. thanks :) sorry aboout the title..wasn't sure how to title this one. lol

if(isset($_POST["submit"]) ){
	if(isset($_POST["est_num"]) ){$est_num= $_POST["est_num"];}
	if(isset($_POST["first_name"]) ){$first_name= $_POST["first_name"];}
	if(isset($_POST["last_name"]) ){$last_name= $_POST["last_name"];}
	if(isset($_POST["address"]) ){$address= $_POST["address"];}
	if(isset($_POST["address_2"]) ){$address_2= $_POST["address_2"];}
	if(isset($_POST["city"]) ){$city= $_POST["city"];}
	if(isset($_POST["state"]) ){$state= $_POST["state"];}
	if(isset($_POST["zip"]) ){$zip= $_POST["zip"];}
	if(isset($_POST["phone"]) ){$phone= $_POST["phone"];}
}
3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by mschroeder
0

Hi,

you may use the following codes:

//to retrieve all POST variables and value
foreach ($_POST as $key => $value){ 
	$$key = $value; 
}

Edited by Javvy: n/a

0

simple enough..lol thanks for that, very useful and simple. But i couldnt think of it.. ha ha Much appreciated. :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.