The only problem I'm having with this is creating some of the session variables I need.
Code: Select all
$query_used = "SELECT * FROM `form` WHERE `used`=1";
$result_used = mysql_query( $query_used ) or die ("could not query the database: <br />". mysql_error());
while ($row = mysql_fetch_assoc( $result_used )){
$name = $row['name'];
// name corresponds to: <input name="first" ...
$_SESSION[$name] = htmlentities($_POST[$name]);
}Code: Select all
$_SESSION['first'] = "bob";
$_SESSION['last'] = "anderson";
$_SESSION['email'] = "bob@domain.ext";
// etc as it hands out the results of the query
// keep in mind the results of the query will exactly match that of the $_POST data, as the fields are generated in the same manner.Other session variables I set manually work though, like:
Code: Select all
$ip = getenv("REMOTE_ADDR");
$_SESSION['ip'] = $ip;
// or
$_SESSION['msg'] = htmlentities($_POST['msg']);
// these are set manually (no loop).