AdRock Posted March 8, 2008 Share Posted March 8, 2008 I have a form with validation that works but i want to seperate php from html. I include the form where i want it and have the php included at the top of the page so th ephp is processed before any html is printed Since doing this i get this error message PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ']' How do i get around this error? It's pointing to this line $postcode = check_input($_POST['postcode']); And here is the code in question (the first part) <?php global $error, $print_again, $register; global $first_name, $last_name; global $houseno, $street, $town, $county, $postcode, $telephone; global $email1, $email2, $username, $password1, $password2; $register = $_POST['register']; function check_form() { //variables for checking the user's name $first_name = check_input($_POST['first_name']); $last_name = check_input($_POST['last_name']); //variable for checking the user address and telephone $houseno = check_input($_POST['houseno']); $street = check_input($_POST['street']); $town = check_input($_POST['town']); $county = check_input($_POST[county']); $postcode = check_input($_POST['postcode']); $telephone = check_input($_POST['telephone']); //variables for checking the user's email $email1 = check_input($_POST['email1']); $email2 = check_input($_POST['email2']); //varaibles for checking the user login credentials $username = check_input($_POST['username']); $password1 = check_input($_POST['password1']); $password2 = check_input($_POST['password2']); and if you need to see this <?php error_reporting(E_ALL); // check the $_GET['page'] variable $page = ((isset($_GET['page']) && $_GET['page'] != '') ? $_GET['page'] : 'home'); // prevent file browsing $page=(preg_match('/(\.\.|\/)/i',$page)?'home':$page); // replace illegal characters $page = preg_replace('/[^a-zA-Z0-9 \._-]/','',$page); // check if the requested file exists $page = (file_exists('./pages/'.$page.'.php') ? $page : 'error'); // include the page include for page title and functions include_once('./pages/'.$page.'.inc.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> Quote Link to comment Share on other sites More sharing options...
spikeon Posted March 8, 2008 Share Posted March 8, 2008 fix: $county = check_input($_POST[county']); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.