PHP input array for adding cookies

Enter Your Name
City
State
Zip
DEMO of adding single data as Cookies
HTML code
<form method=post action=cookies_redirect_array.php>
<div class='row'> <div class='col-md-4'>Enter Your Name </div> <div class='col-md-4'><input type=text name=name class='form-control'> </div> </div>
<div class='row'> <div class='col-md-4'>City </div> <div class='col-md-4'><input type=text name=city class='form-control'> </div> </div>
<div class='row'> <div class='col-md-4'>State </div> <div class='col-md-4'><input type=text name=state class='form-control'> </div> </div>
<div class='row'> <div class='col-md-4'>Zip </div> <div class='col-md-4'><input type=text name=zip class='form-control'> </div> </div>
<div class='row'> <div class='col-md-4'> </div> <div class='col-md-4'><input type=submit value=Next class='btn btn-danger'> </div> </div>
</form>
Code for page cookies_redirect_array.php
<?Php
$name=$_POST['name'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip=$_POST['zip'];

if(isset($name) and strlen($name) > 1){
setcookie ("Plus2netCookie[name]", $name);
setcookie ("Plus2netCookie[city]", $city);
setcookie ("Plus2netCookie[state]", $state);
setcookie ("Plus2netCookie[zip]", $zip);
header ("Location: cookies_t2_array.php"); 
}else{
echo " Input your name first and then click NEXT button 
<input type='button' value='Back' onclick='window.history.back()' />";
}
?>


plus2net.com




Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer