17 Design placement icon

BLOG

Planting Cookies in Booking Forms

A cookie is a powerful tool for planting a snippet of information on the computer of those that visit your website. When used in conjunction with a booking or purchasing form, information such as a person's name, login ID and preferences can be retrieved from a cookie saving time in entering repetitous information. Javascript is a common tool for placing cookies however we prefer PHP. mySQL database variables and form input fields can be records into a PHP variable and then assembled into a neat package. We recently applied the use of Cookies to the launch of the Wheelchair Express Transit website.

Below is an example of how you would set a cookie using PHP and keep it on a person's computer for up to one year:

setcookie("customer", $login_cookie, time()+(60 * 24 * 365));

The variable $login_cookie could include a person's first and last name, customer ID, and the like. Assembly of the variable $login_cookie could look like as follows,

$login_cookie = 'account=' . $account . '&contactfirstname=' . $contactfirstname . '&contactlastname=' . $contactlastname .'&contactphone=' . $contactphone . '&contactemail=' . $contactemail;

by: Creative

«Back»

Protect your website investment with Internet security tips. View BLOG information about Internet development and web design.