因此,我正在编写以下脚本,只是对表单数据的“简单”收集-将其弹出到数据库中,然后快乐的日子!出于某种原因,我只是得到一个空白页——尽管打开了错误报告——它让我发疯!- 有任何想法吗?非常感谢您的帮助。
<?php
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
function isLoggedIn()
{
if(isset($_SESSION['valid']) && $_SESSION['valid'])
return true;
return false;
}
session_start();
//if the user has not logged in
if(!isLoggedIn())
{
header('Location: ../main');
die();
}
//! Checks if the user type is admin full
if ($_SESSION['type'] === 'admin-full')
{
$comp_name = $_POST['comp_name'];
$comp_number = $_POST['comp_number'];
$vat_number = $_POST['vat_number'];
$add1 = $_POST['add1'];
$add2 = $_POST['add2'];
$city = $_POST['city'];
$postcode = $_POST['postcode'];
$branch_name = $_POST['branch_name'];
$contact_name = $_POST['contact_name'];
$contact_number = $_POST['contact_number'];
//! Real_escape the form data
$comp_name = mysql_real_escape_string($comp_name);
$comp_number = mysql_real_escape_string($comp_number);
$vat_number = mysql_real_escape_string($vat_number);
$add1 = mysql_real_escape_string($add1);
$add2 = mysql_real_escape_string($add2);
$city = mysql_real_escape_string($city);
$postcode = mysql_real_escape_string($postcode);
$branch_name = mysql_real_escape_string($branch_name);
$contact_name = mysql_real_escape_string($contact_name);
$contact_number= mysql_real_escape_string($contact_number);
//! MySQL Query
require_once('../Connections/PropSuite.php');
mysql_select_db($database_PropSuite, $PropSuite);
$query = "INSERT INTO franchises
(comp_name, comp_number, vat_number, add1, add2, city, postcode, branch_name, contact_name, contact_number )
VALUES
('$comp_name', '$comp_number', '$vat_number', '$add1', '$add2', '$city', '$postcode', '$branch_name', '$contact_name', '$contact_number');";
mysql_query($query) or die(mysql_error());
mysql_close();
header(location:'franchise-new.php?success');
}
else {
echo('You need to be an admin user to do that!, If you are seeing this message in error, please contact the system administrator.');
}
?>