View Single Post
Old 07-11-07, 03:01 PM   #9
adbox
Registered User
 
Join Date: Jul 2007
Posts: 6
Default Re: Storing Javascript into MYSQL

This is code from the main php file that handles the form editing process. All the code blow is the code that involves the 'goodstats' column

/**
* Sanitize the posted values.
*/
$restaurant_name = Sanitize::data($_POST['restaurant_name'], "string");
$restaurant_address1 = Sanitize::data($_POST['restaurant_address1'], "string");
$restaurant_address2 = Sanitize::data($_POST['restaurant_address2'], "string");
$restaurant_zip = Sanitize::data($_POST['restaurant_zip'], "integer");
$restaurant_phone = Sanitize::data($_POST['restaurant_phone'], "string");
$restaurant_category = Sanitize::data($_POST['restaurant_category'], "integer");
$opening_hours = Sanitize::data($_POST['opening_hours'], "string");
$eat_in = Sanitize::data($_POST['eat_in'], "integer");
$take_out = Sanitize::data($_POST['take_out'], "integer");
$we_deliver = Sanitize::data($_POST['we_deliver'], "integer");
$website = Sanitize::data($_POST['website'], "string");
$goodstats = Sanitize::data($_POST['goodstats'], "string");

/**
* Set the object properties.
*/
$restaurant_obj->setMember("user_id", $_SESSION['logged_user_id']);
$restaurant_obj->setMember("restaurant_name", $restaurant_name);
$restaurant_obj->setMember("restaurant_address1", $restaurant_address1);
$restaurant_obj->setMember("restaurant_address2", $restaurant_address2);
$restaurant_obj->setMember("restaurant_zip", $restaurant_zip);
$restaurant_obj->setMember("restaurant_phone", $restaurant_phone);
$restaurant_obj->setMember("restaurant_category", $restaurant_category);
$restaurant_obj->setMember("opening_hours", $opening_hours);
$restaurant_obj->setMember("eat_in", $eat_in);
$restaurant_obj->setMember("take_out", $take_out);
$restaurant_obj->setMember("we_deliver", $we_deliver);
$restaurant_obj->setMember("website", $website);
$restaurant_obj->setMember("goodstats", $goodstats);

/**
* Try to add the new restaurant to the database.
*/
if($restaurant_obj->edit($error_message)){
/**
* Redirect the user to the "thank you" page.
*/
header("location: company_restaurants.php?id=".$_SESSION['logged_user_id']);
exit;
}
}
$restaurant_name = isset($restaurant_name) ? $restaurant_name : $restaurant_obj->restaurant_name;
$restaurant_address1 = isset($restaurant_address1) ? $restaurant_address1 : $restaurant_obj->restaurant_address1;
$restaurant_address2 = isset($restaurant_address2) ? $restaurant_address2 : $restaurant_obj->restaurant_address2;
$restaurant_zip = isset($restaurant_zip) ? $restaurant_zip : $restaurant_obj->restaurant_zip;
$restaurant_phone = isset($restaurant_phone) ? $restaurant_phone : $restaurant_obj->restaurant_phone;
$restaurant_category = isset($restaurant_category) ? $restaurant_category : $restaurant_obj->restaurant_category;
$opening_hours = isset($opening_hours) ? $opening_hours : $restaurant_obj->opening_hours;
$eat_in = isset($eat_in) ? $eat_in : $restaurant_obj->eat_in;
$take_out = isset($take_out) ? $take_out : $restaurant_obj->take_out;
$website = isset($website) ? $website : $restaurant_obj->website;
$goodstats = isset($goodstats) ? $goodstats : $restaurant_obj->goodstats;
adbox is offline   Reply With Quote