FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Whats the problem with this code





imagefree
Code:
<?php
//original page code.
$form_type=$_POST['form_type'];

if($form_type=='tellafriend')
include('tellafriend.php');

else if($form_type=='contactus')
include('include_contact.php');

else if(!isset($_POST['form_type'])
{
require('include_originalpage.php');
}
?>

its really hard to program in php
at the moment the error is

Quote:
Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\site\project\form_maker.php on line 12

There is nothing on the line 12 above.

and if a change the code a little bit to
Code:
<?php
//original page code.
$form_type=$_POST['form_type'];

if($form_type=='tellafriend')
include('tellafriend.php');

else if($form_type=='contactus')
include('include_contact.php');

else if(!isset($_POST['form_type'])
require('include_originalpage.php');
?>

the error occurs

Quote:
Parse error: syntax error, unexpected T_REQUIRE in C:\xampp\htdocs\site\project\form_maker.php on line 12

what the problem is?
MrBlueSky
You are missing a closing parenthise here:

Quote:

else if(!isset($_POST['form_type'])) // <--
require('include_originalpage.php');
imagefree
thanks Very Happy

please visit this also


http://www.frihost.com/forums/vt-82958.html#694115
mathiaus
Nearly all 'Unexpected' errors are caused by a missing ) or ; from the line above. Remember this and 90% of your problems can be easily solved Smile
flatliner
Quote:
Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\site\project\form_maker.php on line 12
There is nothing on the line 12 above.


Sometimes its not always that line thats making the erorr, it can be the line above it , were you havent close a function with ; or an open quotation mark.
Related topics
Windows Tips&tricks!
One Liners for Code Cowboys
Programming Help & Support Guidelines
PHP upgrade?
CSS Problems + Cache control
Disk Space eaten up
Fatal error in chat
everybody has server 2 problem? [solved]
Need a little help
PHP and relative/absolute paths
setup.php
Signature Code
mysql_num_rows() problem!!
How to show a webpage preview/thumbnail a la ask.com?
Whats the metter
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.