Form Script Assistance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • WSBlue
    Brigadier General

    • Apr 2006
    • 1415

    Form Script Assistance

    Hi ! Naval,
    Below is script (Blue) provided by you and it works.
    But when I try to apply it (Red) on another form, it doesn't work.
    Could you please take a look. Thanks
    <?php
    // Receiving variables
    @$HubNama = addslashes($_POST['HubNama']);
    @$HubAlamatJalan = addslashes($_POST['HubAlamatJalan']);
    @$HubAlamatKota = addslashes($_POST['HubAlamatKota']);
    @$HubAlamatPropinsi = addslashes($_POST['HubAlamatPropinsi']);
    @$HubAlamatKodePos = addslashes($_POST['HubAlamatKodePos']);
    @$HubTelHP = addslashes($_POST['HubTelHP']);
    @$HubEMail = addslashes($_POST['HubEMail']);
    @$HubTanyaSaran = addslashes($_POST['HubTanyaSaran']);
    // Validation
    if (strlen($HubNama) == 0 )
    {
    header("Location: error.htm");
    exit;
    }
    if (strlen($HubAlamatJalan) == 0 )
    {
    header("Location: error.htm");
    exit;
    }
    if (strlen($HubAlamatKota) == 0 )
    {
    header("Location: error.htm");
    exit;
    }
    if (strlen($HubAlamatPropinsi) == 0 )
    {
    header("Location: error.htm");
    exit;
    }
    if (strlen($HubTelHP) == 0 )
    {
    header("Location: error.htm");
    exit;
    }
    if (strlen($HubEMail) == 0 )
    {
    header("Location: error.htm");
    exit;
    }
    if (strlen($HubTanyaSaran) == 0 )
    {
    header("Location: error.htm");
    exit;
    }
    //Sending Email to form owner
    $pfw_header = "From: $HubEMail\n"
    . "Reply-To: $HubEMail\n";
    $pfw_subject = "Saran & Pertanyaan";
    $pfw_email_to = "your e mail address";
    $pfw_message = "HubNama: $HubNama\n"
    . "HubAlamatJalan: $HubAlamatJalan\n"
    . "HubAlamatKota: $HubAlamatKota\n"
    . "HubAlamatPropinsi: $HubAlamatPropinsi\n"
    . "HubAlamatKodePos: $HubAlamatKodePos\n"
    . "HubTelHP: $HubTelHP\n"
    . "HubEMail: $HubEMail\n"
    . "HubTanyaSaran: $HubTanyaSaran\n";
    *****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
    header("Location: confirmation.htm");
    ?>

    --------------------------------------------------------
    --------------------------------------------------------
    Parse error: parse error in /home/httpd/vhosts/beruang.biz/httpdocs/contactus.php on line 58

    <?php
    // Receiving variables
    @$name = addslashes($_POST['name']);
    @$company = addslashes($_POST['company']);
    @$city = addslashes($_POST['city']);
    @$province = addslashes($_POST['province']);
    @$telhp = addslashes($_POST['telhp']);
    @$email = addslashes($_POST['email']);
    @$question = addslashes($_POST['question']);
    // Validation
    if (strlen($name) == 0 )
    {
    header("Location: error2.htm");
    exit;
    }
    if (strlen($company) == 0 )
    {
    header("Location: error2.htm");
    exit;
    }
    if (strlen($city) == 0 )
    {
    header("Location: error2.htm");
    exit;
    }
    if (strlen($province) == 0 )
    {
    header("Location: error2.htm");
    exit;
    }
    if (strlen($telhp) == 0 )
    {
    header("Location: error2.htm");
    exit;
    }
    if (strlen($email) == 0 )
    {
    header("Location: error2.htm");
    exit;
    }
    if (strlen($question) == 0 )
    {
    header("Location: error2.htm");
    exit;
    }
    //Sending Email to form owner
    $pfw_header = "From: $email\n"
    . "Reply-To: $email\n";
    $pfw_subject = "Contact Us";
    $pfw_email_to = "you e mail address
    ";
    $pfw_message = "name: $name\n"
    . "company: $company\n"
    . "city: $city\n"
    . "province: $province\n"
    . "telhp: $telhp\n"
    . "email: $email\n"
    . "question: $question\n"
    *****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; 58
    header("Location: confirmation2.htm");
    ?>
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #2
    Re: Script doesn't work on another form!

    You have missed a " ; " after . "question: $question\n" ;

    Of course, delete that "58" that you have added to see which line is the line with the problem.
    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

    • WSBlue
      Brigadier General

      • Apr 2006
      • 1415

      #3
      Re: Script doesn't work on another form!

      Originally posted by navaldesign
      You have missed a " ; " after . "question: $question\n" ;

      Of course, delete that "58" that you have added to see which line is the line with the problem.
      Hi! Naval,
      Yes, I have corrected it.
      But why, evrytime when I open site beruang.biz/contactus.htm
      error pop up
      X A Runtime Error has occured.
      Do you wish to Debug?
      Line:297
      Error: Object expected

      if I click No, it will go to error page, when I click back to contact us, another error pop up...
      report same thing as above but ...
      Line:16
      Error:Expected identifier

      But if I click yes, it will take forever to debug.

      What shall I do? Please advise. Thank you.

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #4
        Re: Form Script Assistance

        I have tried your fom and it works ok. No error messages or anything, just the php page is extremely slow to load (can't know why). As for the rest it works ok.
        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

        • WSBlue
          Brigadier General

          • Apr 2006
          • 1415

          #5
          Re: Form Script Assistance

          Originally posted by navaldesign
          I have tried your fom and it works ok. No error messages or anything, just the php page is extremely slow to load (can't know why). As for the rest it works ok.
          Hi! Naval,
          I did the www.beruang.biz/contactus.htm , same as
          how I did www.beruang.biz/hubungikami.htm on BV.
          I did validation on every field but why It can't show pop up
          error message like beruang.biz/hubungikami.htm but directly
          goes to www.beruang.biz/error2.htm if error.
          Thanks for your assitance.
          PJR

          Comment

          • Andy128
            Major General

            • Dec 2005
            • 2317

            #6
            Re: Form Script Assistance

            Might I interject a thought-

            If you have both forms in the same directory and are using the same php script to process them- then when prompted for an error- the script is saying pull up error2.html to display the error.

            If you want a different type/design of error page- then you will have to specify that in the script. Lets say you designed an error page and name it error10.html - then would have to put that new error message page in the php script in the appropriate space.

            Hope that makes sense.

            Andy
            PHP- is a blast!

            Comment

            • WSBlue
              Brigadier General

              • Apr 2006
              • 1415

              #7
              Re: Form Script Assistance

              Originally posted by Andy128
              Might I interject a thought-

              If you have both forms in the same directory and are using the same php script to process them- then when prompted for an error- the script is saying pull up error2.html to display the error.

              If you want a different type/design of error page- then you will have to specify that in the script. Lets say you designed an error page and name it error10.html - then would have to put that new error message page in the php script in the appropriate space.
              Hope that makes sense.
              Andy
              Thanks, Andy, But where is the appropriate space in the php script?
              Or Since, the form itself can show pop up error message,
              error2.html actually will not be needed anymore, Is it right?

              Comment

              • navaldesign
                General & Forum Moderator

                • Oct 2005
                • 12080

                #8
                Re: Form Script Assistance

                On the contary. The onform validation is needed for normal users, but they will not protect you against a spammer. So, BOTH validations are needed /as i did ib your custom form): javascript for immediate alert popup, and in the script validation for spammers and upload fields (if you intend using them), as well as radio buttons and checkboxes
                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

                • WSBlue
                  Brigadier General

                  • Apr 2006
                  • 1415

                  #9
                  Re: Form Script Assistance

                  Originally posted by navaldesign
                  On the contary. The onform validation is needed for normal users, but they will not protect you against a spammer. So, BOTH validations are needed /as i did ib your custom form): javascript for immediate alert popup, and in the script validation for spammers and upload fields (if you intend using them), as well as radio buttons and checkboxes
                  I don't need an upload field for this contactus form.
                  I only need alert pop up error message for everyfield that is missing to be filled. How can I do it, just the one on beruang.biz/hubungikami. htm. Thanks.

                  Comment

                  • WSBlue
                    Brigadier General

                    • Apr 2006
                    • 1415

                    #10
                    Re: Form Script Assistance

                    Originally posted by Andy128
                    Might I interject a thought-

                    If you have both forms in the same directory and are using the same php script to process them- then when prompted for an error- the script is saying pull up error2.html to display the error.

                    If you want a different type/design of error page- then you will have to specify that in the script. Lets say you designed an error page and name it error10.html - then would have to put that new error message page in the php script in the appropriate space.

                    Hope that makes sense.

                    Andy
                    I have two different kinds of error page.
                    One form doesn't show error page anymore
                    because it has alert pop up error message,
                    thus it will never go to error.html.

                    The other form, I also want it to do the same.
                    No need to go to error page,
                    but it always goes to error2.html,
                    which I don't want it to.
                    What shall I do; shall I delete the error2.html?

                    Comment

                    • Andy128
                      Major General

                      • Dec 2005
                      • 2317

                      #11
                      Re: Form Script Assistance

                      It appears that you have some form validation with Javascript. The one you are describing is a php error message type. You will have to decide which one you want and then build the form accordingly. The tutorials (Forms) should show how to set up the alert type error message with the built in validation (for each form field- look at the Validate tab in the properties window).

                      It is difficult to walk you through this as some coding knowledge is necessary. Perhaps using Navals DB systems and script writing service would be of benefit?

                      Andy
                      PHP- is a blast!

                      Comment

                      • navaldesign
                        General & Forum Moderator

                        • Oct 2005
                        • 12080

                        #12
                        Re: Form Script Assistance

                        WS, i have set your formulir form with BOTH Javascript validation (which is great for the normally expected user errors) AND validation in the php script (i have the form processed bt ABVFP), so that no spammer can override the Javascript (easily done). If anyone overrides the Javascript validation, he gets against ABVFP's validation that will not allow him to go on.

                        This is a good rule for all validations: have both Javascript (which is more immediate) and php (on script level) validation.

                        You can use the built in BV validation, as Andy has suggested. However, the one i have used for your form is a modified Javascript validation, to allow for personalized messages. BV can NOT, by itself provide this detailed validation.

                        If your second form always goes to the error page, it means that either you Javascript validation is wrong, so it is not activated, OR that there is a mistake in your form that the Javascript doesn't "see", but the php does, so it sends the user to the error page.
                        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

                        • WSBlue
                          Brigadier General

                          • Apr 2006
                          • 1415

                          #13
                          Re: Form Script Assistance

                          Originally posted by navaldesign
                          WS, i have set your formulir form with BOTH Javascript validation (which is great for the normally expected user errors) AND validation in the php script (i have the form processed bt ABVFP), so that no spammer can override the Javascript (easily done). If anyone overrides the Javascript validation, he gets against ABVFP's validation that will not allow him to go on.

                          This is a good rule for all validations: have both Javascript (which is more immediate) and php (on script level) validation.

                          You can use the built in BV validation, as Andy has suggested. However, the one i have used for your form is a modified Javascript validation, to allow for personalized messages. BV can NOT, by itself provide this detailed validation.

                          If your second form always goes to the error page, it means that either you Javascript validation is wrong, so it is not activated, OR that there is a mistake in your form that the Javascript doesn't "see", but the php does, so it sends the user to the error page.
                          LOL! I thought I got it but NO!
                          I opened with Notepad and went through page www.beruang.biz/contactus.htm and found out all Editboxes (1,2,3... ...) were left empty so I named them one by one; Editbox1,2,3... and TextArea1, just like www.beruang.biz/hubungikami.htm
                          But form contactus still can't show pop up error mesaage but connect to contactus.php then show up error2.htm
                          And I also found out this additional script
                          <STYLE type=text/css>IMG {
                          BEHABIOUR:url("pngfix.***")
                          }
                          at hubungikami that didn't show at contactus, so I inserted them at the same position shown in hubungikami at contactus page.
                          But I fail, I can make it like what Naval did.
                          Naval, can you please help to see what went wrong in it ? Thank you.

                          Comment

                          • navaldesign
                            General & Forum Moderator

                            • Oct 2005
                            • 12080

                            #14
                            Re: Form Script Assistance

                            The form has to be built from scratch. If this is the original form you had, built in BV8 the validation will probably not work.
                            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

                            • WSBlue
                              Brigadier General

                              • Apr 2006
                              • 1415

                              #15
                              Re: Form Script Assistance

                              Originally posted by navaldesign View Post
                              The form has to be built from scratch. If this is the original form you had, built in BV8 the validation will probably not work.
                              Hi! Naval,
                              I have managed to show pop up error message when every field is missing or incorrect. BUT even after every field is filled and correct, it still goes to error page. Could you please check it out, where goes wrong?
                              www.beruang.biz/contactus.htm

                              I compare it with www.beruang.biz/hubungikami.htm .
                              I can't find their php script has any differences.
                              But this one can always go to thank you page.
                              Thanks a lot.

                              Comment

                              Working...
                              X