Published in: PHP
//create array to temporarily grab variables //grabs the $_POST variables and adds slashes foreach ($_POST as $key => $input_arr) { } // all $_POST variables have slashes added to them $f_name = $_POST["f_name"]; $l_name = $_POST["l_name"]; $phone_num = $_POST["phone_num"]; $address1 = $_POST["address1"]; $address2 = $_POST["address2"]; $city = $_POST["city"]; $State = $_POST["State"]; $zip = $_POST["zip"]; //sql insert code goes here.
Comments
Subscribe to comments
You need to login to post a comment.

Umm... you don't need to create the temporary array, that is what
foreach ($vars as $var)
does... it creates a temp varriable to hold each one of $vars
If you are going to be putting it into a database, would it not be better to use mysql_real_escape_string(), also noting that add_slashes() is being dropped from the language?