Home   -   News   -   Game Tour   -   Screenshots   -   Rules   -   Chat   -   Contact   -   Forum
pt ro hu de es
pl it no nl en
The Land of Destiny Hero welcomes you.
Role playing game or called MMORPG free browser game
Posts

Breadcrumbs to navigate the website Homepage / Forum / Personal projects / error (2)



Topic: error (2) Post reply

Page: 1 [2] [3] [4]

Alpha tester Posted on: 23-06-2008 17:35:09
Posts: 151



I've made this simple thing in php (i'm learning)
and it gives me back that there is an unexpected '}' on line 31 (that's the 4 last line)

I've saved it as php.php
<html>
<head>
<title>PHP</title>
</head>
<body>
<?php
if( !isset( $_POST['submit']))
{
?>
<form action="php.php" method="post">
<input type="text" name="voornaam" /><br />
</form>
<?php
}
switch( $_POST['voornaam'] )
{
case 'xxx':
$sBand = 'een broer';
break;
case 'xxx':
$sBand = 'mijn pap';
break;
case 'xxx': case 'xxx':
$sBand = 'mijn zus';
break;
case 'xxx':
$sBand = 'mijn mama';
break;
default:
$sBand = 'geen familie'
}
echo $_POST['voornaam'] - ' is ' - $sBand;
</body>
</html>
Moderator Posted on: 23-06-2008 17:36:27
Posts: 461



$sBand = 'geen familie';

dont forget ;
Alpha tester Posted on: 23-06-2008 17:39:01
Posts: 151



Sush stupid fault! xD
Alpha tester Posted on: 23-06-2008 17:41:20
Posts: 151



It just gives a blank page!

and if I go look back to my caode it is changed in:
<html dir="ltr">
    <head>
    </head>
    <body spellcheck="false">
        <p>&nbsp;</p>
    </body>
</html>

I hate those ***
Moderator Posted on: 23-06-2008 17:44:13
Posts: 461



* you can't see php when you click view code in your browser

and it only posts when you use a button
Alpha tester Posted on: 23-06-2008 17:50:02
Posts: 151



yes,
I've found another bug,
I was forgot to say:
?> at the end!
Member Posted on: 23-06-2008 17:50:52
Posts: 822



No, "?>", isn't necessary at the end of a file, only the "<?php" part. A lot of devvers don't put an "?>" at the end.
Moderator Posted on: 23-06-2008 17:51:42
Posts: 461



yea always check your script for ; <?php ?> ' " ( ) { } (etc.)

@peck, didn't know that, but when you do /html and stuff after weher is supposed to be an ?> is it still unneccesary?
Member Posted on: 23-06-2008 17:54:49
Posts: 822



If you want to put some HTML after PHP, you'll have to close the PHP section first with an "?>", or just echo' your HTML.
Alpha tester Posted on: 24-06-2008 08:36:11
Posts: 151



How would I make a sort of textbox where will appear:
echo $_POST['voornaam'] - ' is ' - $sBand;
I already have made a submit button
(was forgot that to)

// edit Peck: please use code tags

Page: 1 [2] [3] [4]

You have to register or login first before you are able to reply.
LoD is a free online rts game free online MMORPG