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"];}
}

Hi,

you may use the following codes:

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

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

No problem :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.