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]

Member Posted on: 24-06-2008 17:12:52
Posts: 822



A dot is a binding operator in PHP, like a + in javascript, << in C++...

@Adram: yes, in this case, but sometimes you can't get around by using a single quote, so it's better you'll learn escaping from the beginning on.
Moderator Posted on: 24-06-2008 17:29:06
Posts: 461



worked fine for me all the time, what times do you mean?
Member Posted on: 24-06-2008 17:34:24
Posts: 822



Can't give an example, actually, but you'll run across some day.
Alpha tester Posted on: 25-06-2008 09:22:13
Posts: 151



<html>
    <head>
        <title>PHP</title>
    </head>
    <body>
        <?php
if( !isset( $_POST['submit']))
{
}
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';
}
?>
        <p>Welkom,</p>
        <?php echo $_POST["voornaam"]; ?>
        <p>.<br />
        Jij bent</p>
        <?php echo $_POST["$sBand"]; ?>
        <p>. ?&gt;</p>
        <p>&nbsp;</p>
    </body>
</html>

I only have one problem.
If I fill a name in on form.htm
and I enter I directly go to php.php (the code above)
that's right.
But, there only comes
Welkom jij bent . ?>
Member Posted on: 25-06-2008 09:27:00
Posts: 822



What's the form?
Alpha tester Posted on: 25-06-2008 09:57:18
Posts: 151



form.htm:
<html dir="ltr">
    <head>
        <title></title>
    </head>
    <body>
        <p>Gelieve uw naam in te vullen</p>
        <form action="php.php" method="post">
            <input name="voornaam" type="text" /><br />
            <input type="submit" name="submit" value="Enter" /><br />
            <submit onclick="www.secrets-of-the-world.110mb.com/php.php"></submit>onclick()
        </form>
    </body>
</html>
Moderator Posted on: 25-06-2008 15:19:26
Posts: 461



why do you need the <submit onclick ... </submit>onclick()?
the form does the submitting&redirecting to php.php for you..
Moderator Posted on: 25-06-2008 15:28:09
Posts: 543



<?php echo $_POST["$sBand"]; ?>
has to be
<?php echo $_POST["sBand"]; ?>
without the $ sign
Moderator Posted on: 25-06-2008 15:29:20
Posts: 461



he's right but where is sBand posted? i only see it being defined as a variable,
Moderator Posted on: 25-06-2008 15:34:25
Posts: 543



then it should say
<?php echo $sBand; ?>
because it's not a $_POST variable but a normal variable

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