Problems with php script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • José
    Private First Class

    • Mar 2006
    • 6

    Problems with php script

    Hello!
    Where can I find a solution or information about this "permanent" message:
    "Warning: Cannot modify header information - headers already sent by (output started at /home/hlrelps/public_html/upload.php:10) in /home/hlrelps/public_html/upload.php on line 17", using my form???
    The "problem starts when I start introducing a validation field in my script. I think that something is wrong with the comand:
    header("Location: upload.html") ;

    Thank you!
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: Problems with php script

    Originally posted by José
    Hello!
    Where can I find a solution or information about this "permanent" message:
    "Warning: Cannot modify header information - headers already sent by (output started at /home/hlrelps/public_html/upload.php:10) in /home/hlrelps/public_html/upload.php on line 17", using my form???
    The "problem starts when I start introducing a validation field in my script. I think that something is wrong with the comand:
    header("Location: upload.html") ;

    Thank you!
    Your problem is in line 10 not 17. You usually get such kind of errors when you mix html and php. If you have used a validation script from the ones presented on this forum, and on the other hand you combined it with some html for the thankyou message, it is quite possible that you will get some errors. If you wish, upload here your script so we can have a look.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    • José
      Private First Class

      • Mar 2006
      • 6

      #3
      Re: Problems with php script

      <?PHP
      @$Email = addslashes($_POST['Email']);
      if (strlen($Email) == 0 )
      {
      header("Location: error.html");
      exit;
      }
      if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
      {
      header("Location: error.html");
      exit;
      }
      $email = $HTTP_POST_VARS[email];
      $mailto = "$Email,webmaster@vaccontrol.com";
      $mailsubj = "Contacto efectuado em VacControl";
      $mailhead = "From: webmaster@vaccontrol.com";
      reset ($HTTP_POST_VARS);
      $mailbody = "Os seguintes campos foram preenchidos:\n";
      while (list ($key, $val) = each ($HTTP_POST_VARS))
      {
      $mailbody .= "$key : $val\n";
      }
      mail($mailto, $mailsubj, $mailbody, $mailhead);
      ?>>

      This is the script that I'm working, I need 1 "Thankyou page" and 2 errors pages: one for e-mail validation and another for name validation. That's all.
      Thank you for help

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #4
        Re: Problems with php script

        <?PHP
        @$Email = addslashes($_POST['Email']);
        if (strlen($Email) == 0 )
        {
        header("Location: error1.html");
        exit;
        }
        if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
        {
        header("Location: error2.html");
        exit;
        }
        $Email = $HTTP_POST_VARS[Email]; DELETE THIS LINE
        $mailto = "webmaster@vaccontrol.com"; CORRECT THIS LINE
        $mailsubj = "Contacto efectuado em VacControl";
        $mailhead = "From: $Email\n"; INSERT THIS LINE
        $mailhead = "From: webmaster@vaccontrol.com"; DELETE THIS LINE
        reset ($HTTP_POST_VARS);
        $mailbody = "Os seguintes campos foram preenchidos:\n";
        while (list ($key, $val) = each ($HTTP_POST_VARS))
        {
        $mailbody .= "$key : $val\n";
        }
        mail($mailto, $mailsubj, $mailbody, $mailhead);
        header("Location: thankyou_page.html"); INSERT THIS LINE FOR YOUR THANKYOU PAGE
        ?>> DELETE THE SECOND ">"



        Create and publish your two error pages "error1" and "error2" and the "thankyou_page"
        Last edited by navaldesign; 04-01-2006, 05:17 AM.
        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment

        • José
          Private First Class

          • Mar 2006
          • 6

          #5
          Re: Problems with php script

          Thank you. I report to you as soon as possible.

          Comment

          • navaldesign
            General & Forum Moderator

            • Oct 2005
            • 12080

            #6
            Re: Problems with php script

            You can use this script:

            <?php
            // Receiving variables
            @$Nome = addslashes($_POST['Nome']);
            @$Apelido = addslashes($_POST['Apelido']);
            @$Organismo = addslashes($_POST['Organismo']);
            @$Comentários = addslashes($_POST['Comentários']);
            @$Email = addslashes($_POST['Email']);
            // Validation
            if (strlen($Email) == 0 )
            {
            header("Location: error1.html");
            exit;
            }
            if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
            {
            header("Location: error2.html");
            exit;
            }
            //Sending Email to form owner
            $pfw_header = "From: $Email\n"
            . "Reply-To: $Email\n";
            $pfw_subject = "Os seguintes campos foram preenchidos";
            $pfw_email_to = "webmaster@vaccontrol.com";
            $pfw_message = "Os seguintes campos foram preenchidos\n"
            . "--------------------------------------------------\n"
            . "Nome: $Nome\n"
            . "Apelido: $Apelido\n"
            . "Organismo: $Organismo\n"
            . "Comentários: $Comentários\n"
            . "Email: $Email\n";
            *****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
            header("Location: thankyou_page.html");
            ?>

            Create the "error1", about empty email field, "error2" for non truelike email, , and "thankyou_page" and publish them. Copy this code and paste it in notepad. Go to "Save as", choose File type "All Files", and save it as "contact.php". Upload it on your server.

            Set your form encoding type in "multipart / form data" .

            You're done!
            Navaldesign
            Logger Lite: Low Cost, Customizable, multifeatured Login script
            Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
            DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
            Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

            Comment

            • José
              Private First Class

              • Mar 2006
              • 6

              #7
              Re: Problems with php script

              Thank you again!!!
              It's working...Ok!
              I think that I have used this script, but the "publishing methode" was incorrect. A this time, I use the BV FTP tool. Usualy I try "publish" with the "BV web builder" and i received an error msg when testing whit IE browser.
              Thank you!

              Comment

              Working...
              X