1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

PHP-script errors..

Discussion in 'Web Design & Development' started by DeniseSamuela, Jun 10, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. DeniseSamuela

    DeniseSamuela Thread Starter

    Joined:
    Jun 6, 2012
    Messages:
    5
    Hi,

    I've tried to test my php-gamescript in UsbWebserver 7.0.
    PHP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    <?php
    function letters_only($string)  

    $eregi eregi_replace("([A-Z]+)","",$string); 
    if(empty(
    $eregi)) { 
    return 
    true

    return 
    false

    if(!
    $POST["submit"])  
        {  
        
    $woorden = array("geweldig""condensatiepolymerisatie""additiepolymerisatie");   
        
    $randomrand(0,count($woorden)-1);  
        
    $woord=$woorden[$random];  
        
    $sessie["woord"]=$woord;  
        
    $teller=7;   
        for (
    $x=0;$x<strlen($woord);$x++){  
        
    $verborgen.="-";}  
        }   
    else  
        {  
        
    $letter=$POST["letter"];  
        
    $woord=$_sessie["woord"];  
        
    $hiddenword=$POST["hidden"];  
        
    $gebruikt=$POST["gebruikt"];  
        
    $teller=$POST["teller"];  
        
    $gebruikt.=$letter;  
        
    $verborgen="";  
        
    $juist=false;  
        }   


    if(
    substr($woord,$x,1)==$letter

    $verborgen.=$letter
    $juist=true


    else 

    $verborgen.=substr($verborgenwoord,$x,1); 

      

    if(!
    $juist
    {  
    $teller--; 


    if (
    $woord==$verborgen

    echo 
    "Gefeliciteerd u heeft het woord geraden<br>"
    echo 
    "Het woord was: ".$woord
    $end=true
    if (
    $teller==0
    echo 
    "U heeft 7 keer geraden, u bent af";  
    echo 
    "<br> Het woord was: ".$woord


    if(
    $end=true); 


    if (!
    $end

    echo 
    "Voorlopig heeft u dit geraden:<br>"
    echo 
    $verborgen
    echo 
    "<br>U heeft nog ".$teller." levens<br>"
    if(
    $gebruikt
    echo 
    "Deze letters heeft u al gebruikt:" .strtoupper($gebruikt); 
    }  
    ?>
    </body>
    </html>
    The test run says the following:
    Notice: Undefined variable: POST in F:\UsbWebserver\Root\game.php on line 17

    Notice: Undefined variable: verborgen in F:\UsbWebserver\Root\game.php on line 25

    Notice: Undefined variable: letter in F:\UsbWebserver\Root\game.php on line 40

    Notice: Undefined variable: letter in F:\UsbWebserver\Root\game.php on line 42

    I really don't understand why the test run says this, because, for example, my $POST is defined in (!$POST["submit"]) , right?

    Can anyone help me with improving my script? I really want my script to be 100% working :)

    Kind regards,

    Denise
     
  2. allnodcoms

    allnodcoms

    Joined:
    Jun 30, 2007
    Messages:
    613
    That should be $_POST["submit"] (note underscore)...

    That will probably fix your script ;)

    Danny
     
  3. dukevyner

    dukevyner

    Joined:
    Nov 4, 2011
    Messages:
    787
    Yup, he's right, if this solves the problem be sure to click the "mark solved" button at the top of the page
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1056526