Page 1 of 1

help please....

Posted: Fri Mar 07, 2003 11:47 am
by node
can someone please tell me why this is'nt working ?

Code: Select all

<?

$date = date("M n, Y");
$time = date("g:ma");
$font ='<font face="verdana" size="2">';


    if(empty($_POST&#1111;"domname"])) &#123;
        $error = "<center><B>Error!</B><BR>You must enter your Domain Name.</center><P>";
    &#125;

    if(! empty($_POST&#1111;"email"])) &#123;
        $result = eregi("^&#1111;_a-z0-9-]+(\.&#1111;_a-z0-9-]+)*@&#1111;a-z0-9-]+(\.&#1111;a-z0-9-]+)*$", $_POST&#1111;"email"] );
        if(! $result) &#123;
            $error .= "<center><B>Error!</B><BR>You must enter a vaild Email.(ex: joe@yourdomain.com)</center><P>";

        &#125; else &#123;
            return true;
        &#125;
    &#125;

    if(empty($_POST&#1111;"comp_name"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter your Company Name. If no company name, just use your First and Last name.</center><P>";
    &#125;

    if(empty($_POST&#1111;"fname"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter your First Name.</center><P>";
    &#125;
    if(empty($_POST&#1111;"lname"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter your Last Name.</center><P>";
    &#125;

    if(empty($_POST&#1111;"addr"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter your Address.</center><P>";
    &#125;
    if(empty($_POST&#1111;"city"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter your City.</center><P>";
    &#125;


    if(empty($_POST&#1111;"state"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter your State in its 2 letter abriviation. (Ex: TX)</center><P>";
    &#125;

    if($_POST&#1111;"country"] == "no") &#123;
        $error .= "<center><B>Error!</B><BR>You must choose a Country from the drop-down box</center><P>";
    &#125;

    if(empty($_POST&#1111;"zip"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter your Zip Code in the format: <B>90210</B></center><P>";
    &#125;

    if(empty($_POST&#1111;"phone"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter your Phone Number.</center><P>";
    &#125;

    if(empty($_POST&#1111;"os"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter your Operating System.</center><P>";
    &#125;

    if(! $_POST&#1111;"racked"]) &#123;
        $error .= "<center><B>Error!</B><BR>You must enter whether or not your server is rackable.</center><P>";
    &#125;
    if($_POST&#1111;"racked"] == "no") &#123;
        if( empty($_POST&#1111;"dem_w"]) OR empty($_POST&#1111;"dem_h"]) OR empty($_POST&#1111;"dem_l"])) &#123;
            $error .= "<center><B>Error!</B><BR>You must enter you boxes Deminsions.</center><P>";
        &#125;
    &#125;


    if(! $_POST&#1111;"game"]) &#123;
        $error .= "<center><B>Error!</B><BR>You must specify whether your running a Game Server.</center><P>";
    &#125;

    if(! $_POST&#1111;"irc"]) &#123;
        $error .= "<center><B>Error!</B><BR>You must specify whether your running a IRC Server</center><P>";
    &#125;
    if(! $_POST&#1111;"iso"]) &#123;
        $error .= "<center><B>Error!</B><BR>You must specify whether your serving .ISO files.</center><P>";
    &#125;

    if(! $_POST&#1111;"mirror"]) &#123;
        $error .= "<center><B>Error!</B><BR>You must specify whether you act as a Mirror for popular sites.</center><P>";
    &#125;

    if(! $_POST&#1111;"srv"]) &#123;
        $error .= "<center><B>Error!</B><BR>You must specify whether any of your customers server files.</center><P>";
    &#125;

    if(empty($_POST&#1111;"hosted"])) &#123;
        $error .= "<center><B>Error!</B><BR>You must list the sites you currently host.</center><P>";
    &#125;
    if($error) &#123;
        echo $error;
        exit;()
   &#125; else &#123;

?>
What im wanting is for it to stop when it comes across an error, then display the error. If no errors then show the users input. After the `} else {` is the html to display then after the html i close the curly bracket. Im using a free PHP hosting provider, if that helps?
Thanks for the help.

- node

Posted: Fri Mar 07, 2003 11:50 am
by daven
try initializing error at the beginning of your code ($error=""). The way you have it set up, if you get past the empty($_POST["domname"])) part, $error is never initialized. '.=' does not create a variable, and therefore $error never exists.

Posted: Fri Mar 07, 2003 12:00 pm
by node
right on man thanks. i'll try that out..sounds resonable :D thats why i love this place fast reponses and good help. thanks again.