Menu

Undefined Variables-Need Help

Help
goochie65
2007-08-21
2013-06-03
  • goochie65

    goochie65 - 2007-08-21

    I continue to get the following errors when I submit (test) my form:

    PHP Notice:  Undefined index:  HTTPS
    PHP Notice:  Undefined variable:  SERVER_NAME
    PHP Notice:  Undefined variable:  PHP_SELF

    Here is the code for my process.php file:

    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','medium');
    pt_register('POST','meetings');
    pt_register('POST','pedsign');
    pt_register('POST','lease');
    pt_register('POST','leased');
    pt_register('POST','topic');
    pt_register('POST','speaker');
    pt_register('POST','committee');
    pt_register('POST','program');
    pt_register('POST','interactions');
    pt_register('POST','improvements');
    $improvements=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $improvements);
    pt_register('POST','opinion');
    $opinion=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $opinion);
    pt_register('POST','street');
    pt_register('POST','email');
    pt_register('POST','phone');
    if($email=="" ){
    $errors=1;
    $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
    }
    if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){
    $error.="<li>Invalid email address entered";
    $errors=1;
    }
    if($errors==1) echo $error;
    else{
    $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="medium: ".$medium."
    meetings: ".$meetings."
    pedsign: ".$pedsign."
    lease: ".$lease."
    leased: ".$leased."
    topic: ".$topic."
    speaker: ".$speaker."
    committee: ".$committee."
    program: ".$program."
    interactions: ".$interactions."
    improvements: ".$improvements."
    opinion: ".$opinion."
    street: ".$street."
    email: ".$email."
    phone: ".$phone."
    ";
    $message = stripslashes($message);
    mail("webmaster@prestonmeadowhoa.org","Survey Form Submitted at website",$message,"From: phpFormGenerator");

    header("Refresh: 0;url=http://www.prestonmeadowhoa.org/thanks.html");
    ?><?php
    }
    ?>

    Any suggestions as to why I'm getting these errors, and how I can correct them?

    I've tried removing the line: $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    ...that did not help.

    TIA for any help you can provide.

     
    • TNTEverett

      TNTEverett - 2007-08-21

      All 3 errors come from the same line in your process.php file:
      $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));

      Note the occurrances of the following:
      HTTPS
      SERVER_NAME
      PHP_SELF

      Since this variable "$where_form_is" does not appear anywhere in the process.php, remove the line.  If the error still occurrs, then you haven't removed the line.

       
    • goochie65

      goochie65 - 2007-08-21

      I removed the line, and got no errors this time, however the email was not delivered.

       
      • TNTEverett

        TNTEverett - 2007-08-21

        Not receiving an email is different from the other errors.  Was the email sent before?

        Beyond that I know web hosts are being forced to define tougher spam filters.  The "From:" field in your mail() function is not a valid email address.  Try chaning it from this:
        mail("webmaster@prestonmeadowhoa.org","Survey Form Submitted at website",$message,"From: phpFormGenerator");
        to this:
        mail("webmaster@prestonmeadowhoa.org","Survey Form Submitted at website",$message,"webmaster@prestonmeadowhoa.org");

         
    • goochie65

      goochie65 - 2007-08-21

      Thank you, it's working again...

      To allow muliple checkboxes I must create a separate field for each box, correct?

       
      • TNTEverett

        TNTEverett - 2007-08-21

        Check boxes come in many forms and with many conditions.  Essentially each check box has one of two values (checked, or not checked).  The limits on how many boxes are allowed to be checked are defined by the form developer. 

         
    • Musawir Ali

      Musawir Ali - 2007-08-24

      "Notices" are not "Errors". You should not have notices turned in your PHP settings in the first place, they are only for debugging purposes.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.