Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Unexpected Error, Undefined variable???
Propeng
post Sep 29 2007, 09:15 AM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 11
Joined: 24-September 07
Member No.: 25,093



Is this script correct?

index.php:
CODE
<?php
    if (isset($_COOKIE["disp_name"]))
          $_GET['name'] = $_COOKIE['disp_name'];
    else
        setcookie("disp_name", Anonymous, date()+99);
?>
<html>
    <head>
        <title>Display Name - DZN</title>
        <!-- METAS -->
        <meta name="verify-v1" content="oyEmG+TJ87xHGXl8NQS6GHJ8rcRDkFG4oXnYWtqddGk=" />
    </head>
    <body>
        <div align="center">
            <form action="proccess.php" method="get">
                <?php if ($_GET["name"]=="") {$_GET['name']="Anonymous";} ?>
                Dislpay Name: <input type="text" value=<?php echo $_GET['name']; ?> name="name" />
                <input type="submit" value="Enter Website!" />
            </form>
        </div>
        <?php $wn = "Download Zone Network"; $swn = "DZN"; ?>
    </body>
</html>


proccess.php:
CODE
<head>
    <title>Proccessing Request...</title>
    <meta http-equiv="Refresh" content="1; URL=main.php" />
    <b>Please wait...</b>
</head>
<?php
    setcookie("disp_name", $_GET['name'], date()+99);
?>


main.php:
CODE
<?php
    function customError($errno, $errstr)
    {
        echo "<div align='center'><b>Error:</b> [$errno] $errstr<br /></div>";
        echo "<div align='center'>Ending Script</div>";
        die();
    }
?>
<?php //Page Config.
    //REQUIRE
      $_GET['name'] = $_COOKIE['disp_name'];
      /* do: echo (remember) */
      //          echo $_GET['name']          //
      if ($_COOKIE['disp_name']=="")
      {
        $_GET['name'] = "Guest";
    }
    function currentlyOnline()
    {
        echo "";
    }
    set_error_handler("customError");
    function showCO ($showCO)
    {
        echo "ddd";
    }
    while ($showCO=="true")
    {
        showCO();
    }
?>
<?php
    echo "<title>Welcome back, " . $_GET['name'] . "! - DZN</title>";
    showCO ($showCO);
    $showCO = "true";
?>
(Not all the file; just the piece that encounters the problem)

Everything goes fine, but when i enter main.php, it displays:
QUOTE
Error: [8]Undefined variable: showCO
Ending Script


Is this script wrong? If it has, please reply. I know that the problem is in the main.php only, but i copied all of them if you want to test it.

This post has been edited by Propeng: Sep 29 2007, 09:18 AM
Go to the top of the page
 
+Quote Post
TavoxPeru
post Sep 29 2007, 11:46 AM
Post #2


Super Member
Group Icon

Group: [HOSTED]
Posts: 740
Joined: 8-April 06
From: Lima - Peru
Member No.: 12,579



QUOTE(Propeng @ Sep 29 2007, 04:15 AM) *
main.php:
CODE
<?php
    function customError($errno, $errstr)
    {
        echo "<div align='center'><b>Error:</b> [$errno] $errstr<br /></div>";
        echo "<div align='center'>Ending Script</div>";
        die();
    }
?>
(Not all the file; just the piece that encounters the problem)

Everything goes fine, but when i enter main.php, it displays:
Is this script wrong? If it has, please reply. I know that the problem is in the main.php only, but i copied all of them if you want to test it.

I think that the problem is related with the brackets that you use in your customError() function. Try this:
CODE
<?php
    function customError($errno, $errstr)
    {
        echo "<div align='center'><b>Error:</b> [" . $errno . "] $errstr<br /></div>";
        echo "<div align='center'>Ending Script</div>";
        die();
    }
?>

Best regards,
Go to the top of the page
 
+Quote Post
robert2411
post Sep 29 2007, 08:37 PM
Post #3


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 23
Joined: 27-September 07
Member No.: 25,159



put this error_reporting(E_ALL); abover you main script directly after <?php
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Php Problem Error Message(9)
  2. Php Variable Concatenation(7)
  3. In Php, How To Not Display Mysql Connection Error?(4)
  4. Help: $_post Variable For Options From Select Types?(6)
  5. How To Reset The Server Variable Php_auth_user(9)
  6. E-mail List Error(4)
  7. Got A Wee Error - Can You Help?(13)
  8. Variable From Line Further Then Current Line?(13)
  9. Quickly Create Form Variables(5)
  10. Error On Submit Page(10)
  11. Php Any Variable In String.(1)
  12. Something Wrong With This Script?(9)
  13. Php Math Error(4)
  14. Send Php Variable To Javascript(5)
  15. Warning: Mysql_num_rows()(1)
  1. Php Error-where To Put "?>"(2)
  2. Cant Find The Error(2)


 



- Lo-Fi Version Time is now: 22nd August 2008 - 03:11 AM