I have created a new database table with the name ‘table’. Now i’m trying the following code to write the data into the fields:
if (isset ($_POST['request'])) {
$F1 = $_POST['F1'];
$F2 = $_POST['F2'];
$F3 = $_POST['F3'];
$F4 = $_POST['F4'];
$sql_data_array = array('F1' => zen_db_prepare_input($_POST['F1']),
'F2' => zen_db_prepare_input($_POST['F2']));
zen_db_perform('table', $sql_data_array);
$db->Execute("insert into requests (F1, F2, F3, F4) values ('".$F1."', '"$F2."', '".$F3."', '".$F4. "')");
}
When i press the submit button i get blank page. It means something wrong with my code.
Where is the mistake? Please help me out.
A couple of things:
Don’t just take the posted values; do some cleanup on them to ensure you won’t get hacked.
“table” is really not a great name for a table. It’s probably a reserved word, so you really want to call it (say) “fawad_table”.
If you then do this:
it will ONLY work if you don’t use a prefix in your configure.php file. If you do this will fail. The better thing is to create
which does something like
then you can use
and it will work with or without a prefix.