Announcement

Collapse
No announcement yet.

need help with form and php stuff

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • need help with form and php stuff

    I watched both tutorials about forms and have gone over it many times to make sure I did it right. i can't get my form on my index page to go to my thank you page. I've done the everything I can think of.

    I made sure the form has php. my thank you page has the right code just like the video, but when i fill out the form and hit submit I get this error to go to my thank you page

    Not Found

    The requested URL /action.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Need help very frustrated. I'm a newbie trying to learn something new, and I'm missing somrthing.
    Thank you so much for any help.
    todd
    client ID 14855

  • #2
    Re: need help with form and php stuff

    Todd, Naval's usually the "form guy" but he's not on right now. I wouldn't know which questions to ask you, but you can send me your form and thank you pages at dmapillar********.com and I can take a look at them for you.

    Comment


    • #3
      Re: need help with form and php stuff

      Your problem is typically either a typo or basic error. I.e.: setting the form action in "action.php" and instead, having the "action" page saved (and published) as "thankyou.php".

      Please provide links to your form and your thank you page so i 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


      • #4
        Re: need help with form and php stuff

        Hi, I having some real trouble with this and it's about the final thing for my site. I'm getting this error when I run my page:

        Parse error: syntax error, unexpected $end in /home/ruqmcinn/public_html/StrategicAlliancesApp.php on line 202

        here's the code that causes it:

        <?php



        session_start();
        include("database.php");

        //see if name already exists in database

        function co_Exists($Co_Name){
        global $conn;
        if(!get_magic_quotes_gpc()){
        $Co_Name = addslashes($Co_Name);
        }
        $q = "select Co_Name from alliances where Co_Name = '$Co_Name'";
        $result = mysql_query($q,$conn);
        return (mysql_numrows($result) > 0);
        if(co_Exists($_POST['Co_Name'])){
        $use = $_POST['Co_Name'];
        die("Sorry, the Company Name: <strong>$use</strong> already exists in our records.");
        }
        }
        if(isset($_POST['submit'])){
        /* Make sure all fields were entered */
        if(!$_POST['Co_Name'] || !$_POST['Name'] || !$_POST['Email'] || !$_POST['Phone'] || !$_POST['City'] || !$_POST['State'] || !$_POST['Fax'] || !$_POST['Business'] || !$_POST['Address'] || !$_POST['Zip']){
        die('You didn\'t fill in a required field.');
        }


        function addAlliance($Co_Name, $Name, $Email, $Phone, $City, $State, $Fax, $Business, $Address, $Zip,$ReferralID,$Referredby){
        global $conn;
        $q = "INSERT INTO alliances VALUES ('$Co_Name', '$Name', '$Email', '$Phone, '$City', '$State', '$Fax', '$Business', '$Address', '$Zip','$Referredby')";
        return mysql_query($q,$conn);
        }
        ?>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
        <html>
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>STRATEGIC ALLIANCES PROGRAM Applicatrion</title>
        <script type="text/javascript">
        function agree(){
        if(document.AllianceForm.IAgree.checked == false){
        alert("You MUST agree to the terms and conditions to join!")
        }
        }
        </script>
        <meta name="GENERATOR" content="Created by BlueVoda">
        <style type="text/css">
        div#container
        {
        width: 1266px;
        position: relative;
        margin-top: 0px;
        margin-left: auto;
        margin-right: auto;
        text-align: left;
        }
        body
        {
        text-align: center;
        margin: 0;
        }
        </style>
        <style type="text/css">
        a.style1:link {color: #FF0000;}
        a.style1:visited {color: #FF0000;text-decoration: underline;}
        a.style1:active {color: #FF0000;text-decoration: underline;}
        a.style1:hover {color: #FF0000;text-decoration: underline;}
        </style>
        </head>
        <body bgcolor="#FFFFFF" text="#000000">
        <div id="container">
        <div id="bv_" style="position:absolute;left:0px;top:0px;width:12 61px;height:907px;z-index:29" align="left">
        <img src="bv01027.gif" id="" align="top" alt="" border="0" width="1261" height="907"></div>
        <div id="bv_" style="position:absolute;left:0px;top:93px;width:1 261px;height:27px;z-index:30" align="left">
        <img src="bv01028.gif" id="" align="top" alt="" border="0" width="1261" height="27"></div>
        <div id="bv_" style="position:absolute;left:0px;top:0px;width:12 61px;height:93px;z-index:31" align="left">
        <img src="bv01031.gif" id="" align="top" alt="" border="0" width="1261" height="93"></div>
        <div id="bv_" style="position:absolute;left:218px;top:0px;width: 830px;height:94px;z-index:32" align="left">
        <img src="bv01029.gif" id="" align="top" alt="" border="0" width="830" height="94"></div>
        <img src="coach2 update copy.jpg" id="" alt="" align="top" border="0" width="71" height="88" style="position:absolute;left:433px;top:3px;width: 71px;height:88px;z-index:33">
        <div id="bv_" style="position:absolute;left:523px;top:12px;width :324px;height:55px;z-index:34" align="left">
        <FONT style="font-size:48px" color="#000000" face="Eras Demi ITC"><B>CreditCoach</B></FONT><FONT style="font-size:24px" color="#000000" face="Eras Demi ITC">™</FONT></div>
        <div id="bv_" style="position:absolute;left:477px;top:56px;width :409px;height:33px;z-index:35" align="center">
        <FONT style="font-size:21px" color="#000000" face="Papyrus"><B>We help you reach financial success</B></FONT></div>
        <hr noshade size="8" width="1261" color="#000000" id="" style="position:absolute;left:0px;top:102px;width: 1261px;height:8px;z-index:36">
        <div id="bv_" style="position:absolute;left:0px;top:856px;width: 1261px;height:27px;z-index:37" align="left">
        <img src="bv01108.gif" id="" align="top" alt="" border="0" width="1261" height="27"></div>
        <hr noshade size="8" width="1261" color="#000000" id="" style="position:absolute;left:0px;top:866px;width: 1261px;height:8px;z-index:38">
        <div id="bv_" style="position:absolute;left:162px;top:137px;widt h:936px;height:709px;z-index:39" align="left">
        <img src="bv01107.gif" id="" align="top" alt="" border="0" width="936" height="709"></div>
        <div id="bv_" style="position:absolute;left:266px;top:206px;widt h:742px;height:620px;z-index:40" align="left">
        <form name="AllianceForm" method="POST" action="" enctype="multipart/form-data" id="Form1">
        <input type="text" id="Editbox2" style="position:absolute;left:177px;top:247px;widt h:144px;font-family:Courier;font-size:19px;z-index:0" size="16" name="Co_Name" value="" maxlength="30">
        <div id="bv_Text3" style="position:absolute;left:47px;top:248px;width :131px;height:18px;z-index:1" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Company Name:</font></div>
        <input type="text" id="Editbox1" style="position:absolute;left:178px;top:285px;widt h:144px;font-family:Courier;font-size:19px;z-index:2" size="16" name="Name" value="" maxlength="40">
        <div id="bv_Text4" style="position:absolute;left:91px;top:289px;width :81px;height:18px;z-index:3" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Full Name:</font></div>
        <input type="text" id="Editbox4" style="position:absolute;left:177px;top:320px;widt h:144px;font-family:Courier;font-size:19px;z-index:4" size="16" name="Email" value="" maxlength="30">
        <div id="bv_Text5" style="position:absolute;left:118px;top:323px;widt h:58px;height:18px;z-index:5" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Email:</font></div>
        <input type="text" id="Editbox3" style="position:absolute;left:178px;top:358px;widt h:144px;font-family:Courier;font-size:19px;z-index:6" size="16" name="Phone" value="" maxlength="16">
        <div id="bv_Text6" style="position:absolute;left:79px;top:360px;width :131px;height:18px;z-index:7" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Phone:</font></div>
        <input type="text" id="Editbox6" style="position:absolute;left:177px;top:394px;widt h:144px;font-family:Courier;font-size:19px;z-index:8" size="16" name="City" value="" maxlength="16">
        <div id="bv_Text7" style="position:absolute;left:133px;top:396px;widt h:42px;height:18px;z-index:9" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">City: </font></div>
        <div id="bv_Text13" style="position:absolute;left:123px;top:431px;widt h:53px;height:18px;z-index:10" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">State: </font></div>
        <input type="checkbox" id="Checkbox2"" name="IAgree" value="" style="position:absolute;left:242px;top:514px;z-index:11">
        <div id="bv_Text8" style="position:absolute;left:431px;top:245px;widt h:41px;height:18px;z-index:12" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Fax:</font></div>
        <div id="bv_Text9" style="position:absolute;left:341px;top:285px;widt h:131px;height:18px;z-index:13" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Type of Business:</font></div>
        <div id="bv_Text10" style="position:absolute;left:387px;top:318px;widt h:86px;height:18px;z-index:14" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Address 1:</font></div>
        <div id="bv_Text11" style="position:absolute;left:390px;top:356px;widt h:82px;height:18px;z-index:15" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Address 2:</font></div>
        <div id="bv_Text12" style="position:absolute;left:437px;top:392px;widt h:36px;height:18px;z-index:16" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Zip: </font></div>
        <div id="bv_Text14" style="position:absolute;left:264px;top:513px;widt h:219px;height:19px;z-index:17" align="center">
        <font style="font-size:16px" color="#000000" face="Times New Roman">I agree to the <a href="http://www.youronlinecreditcoach.com/StrategicAlliancesTerms.html" class="style1">terms and conditions</a>.</font></div>
        <div id="bv_Text2" style="position:absolute;left:165px;top:8px;width: 409px;height:54px;z-index:18" align="center">
        <font style="font-size:24px" color="#000000" face="Arial">STRATEGIC ALLIANCES PROGRAM <br>
        APPLICATION</font></div>
        <input type="text" id="Editbox5" style="position:absolute;left:473px;top:244px;widt h:144px;font-family:Courier;font-size:19px;z-index:19" size="16" name="Fax" value="" maxlength="16">
        <input type="text" id="Editbox8" style="position:absolute;left:474px;top:282px;widt h:144px;font-family:Courier;font-size:19px;z-index:20" size="16" name="Business" value="" maxlength="30">
        <input type="text" id="Editbox7" style="position:absolute;left:473px;top:317px;widt h:144px;font-family:Courier;font-size:19px;z-index:21" size="16" name="Address" value="" maxlength="30">
        <input type="text" id="Editbox10" style="position:absolute;left:474px;top:355px;widt h:144px;font-family:Courier;font-size:19px;z-index:22" size="16" name="Addres2" value="" maxlength="30">
        <input type="text" id="Editbox9" style="position:absolute;left:473px;top:391px;widt h:144px;font-family:Courier;font-size:19px;z-index:23" size="16" name="Zip" value="" maxlength="16">
        <div id="bv_Text1" style="position:absolute;left:7px;top:93px;width:7 25px;height:54px;z-index:24" align="justify">
        <font style="font-size:16px" color="#000000" face="Arial">Please fill out this form with the name and address of the individual and/or business enrolling in the Strategic Alliances Program. This is the person to whom we will address all correspondence about participation in the program. </font></div>
        <select name="State" size="1" id="Combobox1" style="position:absolute;left:174px;top:430px;widt h:150px;font-family:MS Shell Dlg;z-index:25">
        <option value="AL">Alabama</option>
        <option value="AK">Alaska</option>
        <option value="AZ">Arizona</option>
        <option value="AR">Arkansas</option>
        <option value="CA">California</option>
        <option value="CO">Colorado</option>
        <option value="CT">Connecticut</option>
        <option value="DE">Delaware</option>
        <option value="FL">Florida</option>
        <option value="GA">Georgia</option>
        <option value="HI">Hawaii</option>
        <option value="ID">Idaho</option>
        <option value="IL">Illinois</option>
        <option value="IN">Indiana</option>
        <option value="IA">Iowa</option>
        <option value="KS">Kansas</option>
        <option value="KY">Kentucky</option>
        <option value="LA">Louisiana</option>
        <option value="ME">Maine</option>
        <option value="MD">Maryland</option>
        <option value="MA">Massachusetts</option>
        <option value="MI">Michigan</option>
        <option value="MN">Minnesota</option>
        <option value="MS">Mississippi</option>
        <option value="MO">Missouri</option>
        <option value="MT">Montana</option>
        <option value="NE">Nebraska</option>
        <option value="NV">Nevada</option>
        <option value="NH">New Hampshire</option>
        <option value="NJ">New Jersey</option>
        <option value="NM">New Mexico</option>
        <option value="NY">New York</option>
        <option value="NC">North Carolina</option>
        <option value="ND">North Dakota</option>
        <option value="OH">Ohio</option>
        <option value="OK">Oklahoma</option>
        <option value="OR">Oregon</option>
        <option value="PA">Pennsylvania</option>
        <option value="RI">Rhode Island</option>
        <option value="SC">South Carolina</option>
        <option value="SD">South Dakota</option>
        <option value="TN">Tennessee</option>
        <option value="TX">Texas</option>
        <option value="UT">Utah</option>
        <option value="VT">Vermont</option>
        <option value="VA">Virginia</option>
        <option value="WA">Washington</option>
        <option value="WV">West Virginia</option>
        <option value="WI">Wisconsin</option>
        <option value="WY">Wyoming</option>
        </select>
        <input type="text" id="Editbox11" style="position:absolute;left:473px;top:429px;widt h:144px;font-family:Courier;font-size:19px;z-index:26" size="16" name="Referredby" value="" maxlength="9">
        <div id="bv_Text15" style="position:absolute;left:385px;top:431px;widt h:85px;height:18px;z-index:27" align="center">
        <font style="font-size:16px" color="#000000" face="Arial">Referral ID:</font></div>
        <input type="submit" id="Button1" onclick="agree();return false;"" name="submit" value="Submit" style="position:absolute;left:326px;top:553px;widt h:82px;height:31px;z-index:28">
        </form>
        </div>
        </div>
        </body>
        </html>
        This is urgent!

        Comment


        • #5
          Re: need help with form and php stuff

          die('You didn\'t fill in a required field.');
          }

          }

          You have left out a '}'
          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


          • #6
            Re: need help with form and php stuff

            Thanks, that's corrected, but now the data won't submit to the database.
            Is my code in the proper order?

            Comment


            • #7
              Re: need help with form and php stuff

              Storing in the database is done through the function

              function addAlliance($Co_Name, $Name, $Email, $Phone, $City, $State, $Fax, $Business, $Address, $Zip,$ReferralID,$Referredby){
              global $conn;
              $q = "INSERT INTO alliances VALUES ('$Co_Name', '$Name', '$Email', '$Phone, '$City', '$State', '$Fax', '$Business', '$Address', '$Zip','$Referredby')";
              return mysql_query($q,$conn);
              }


              There is also anoher function, that should provide the error message if the company name already exists in the database:
              function co_Exists($Co_Name){
              global $conn;
              if(!get_magic_quotes_gpc()){
              $Co_Name = addslashes($Co_Name);
              }
              $q = "select Co_Name from alliances where Co_Name = '$Co_Name'";
              $result = mysql_query($q,$conn);
              return (mysql_numrows($result) > 0);
              if(co_Exists($_POST['Co_Name'])){
              $use = $_POST['Co_Name'];
              die("Sorry, the Company Name: <strong>$use</strong> already exists in our records.");
              }
              }

              However, though these two functions are defined, they are NOT used.

              I also do not understand why you are defining functions. Function definition is usually done in a self standing file, that is then included in ALL your scripts (because common to all, it is a way of avoiding writing always the same code). In this case, the function is defined inside the script itself, and then it is not useful to any other script, so no need for function definition. The script should be changed to

              <?php
              session_start();
              include("database.php");
              //see if name already exists in database
              function co_Exists($Co_Name){
              global $conn;
              if(!get_magic_quotes_gpc()){
              $Co_Name = addslashes($Co_Name);
              }
              $q = "select Co_Name from alliances where Co_Name = '$Co_Name'";
              $result = mysql_query($q,$conn);
              return (mysql_numrows($result) > 0);
              if(co_Exists($_POST['Co_Name'])){
              $use = $_POST['Co_Name'];
              die("Sorry, the Company Name: <strong>$use</strong> already exists in our records.");
              }
              }
              if(isset($_POST['submit'])){
              /* Make sure all fields were entered */
              if(!$_POST['Co_Name'] || !$_POST['Name'] || !$_POST['Email'] || !$_POST['Phone'] || !$_POST['City'] || !$_POST['State'] || !$_POST['Fax'] || !$_POST['Business'] || !$_POST['Address'] || !$_POST['Zip']){
              die('You didn\'t fill in a required field.');
              }
              }
              co_Exists($Co_Name);
              function addAlliance($Co_Name, $Name, $Email, $Phone, $City, $State, $Fax, $Business, $Address, $Zip,$ReferralID,$Referredby){
              global $conn;
              $q = "INSERT INTO alliances VALUES ('$Co_Name', '$Name', '$Email', '$Phone, '$City', '$State', '$Fax', '$Business', '$Address', '$Zip','$Referredby')";
              return mysql_query($q,$conn);
              }
              addAlliance($Co_Name, $Name, $Email, $Phone, $City, $State, $Fax, $Business, $Address, $Zip,$ReferralID,$Referredby);
              ?>

              However, i don't understand why you have pasted this code in the same page as the form, it should be in a page that would provide a confirmation message. Also, your form action doesn't exist so the form doesn't do anything at all.
              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


              • #8
                Re: need help with form and php stuff

                Thanks I fixed that.
                NOW, I can't figure out how to make this form cover the entire page
                for those who have not logged in.
                Here's the link take a look and tell me what you think I should do:

                http://youronlinecreditcoach.com/test.php

                Thanks

                Comment


                • #9
                  Re: need help with form and php stuff

                  I'm not sure what you mean by "cover the entire page".

                  If you mean that you want additional visual elements to create a better looking page, this depends entirely on the part of the script that creates the visual part (the form).
                  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


                  • #10
                    Re: need help with form and php stuff

                    Thanks so much Naval. What I meant was that the login script that I created was showing up on the top of my page and the rest of the page was completely visible. But, you don't have to worry about it cuz I figured out how to fix it. I introduced some code to redirect the user to a page with only the login. Here's what I want to know now.

                    When I change the permissions on my php file in my ftp program it reverts back to the original permissions. Also I'm not sure if it's a good idea to change the file permissions to 000 or not. I want to be able to access and use the file, but I do not want this file to be visible to others.

                    Comment


                    • #11
                      Re: need help with form and php stuff

                      Again, i'm not sure what you mean by "change permissions to 000". Setting permissions to 000 means that NO ONE will be able to reach the file. Even you will need to change the permissions (through FTP or File Manager) in order to work with it directly on the server. Of course, you can also work with the file directly on your computer, upload the edited version, and then change it to 000. But what file are you talking about? and why should it be set to 000 ? usually only installation files are set to 000 so that no one, even knowing the existance and the URL of the file, will be able to open/execute it.

                      Anyway, the code of php files is not visible through a browser, (only their html output is).
                      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


                      • #12
                        Re: need help with form and php stuff

                        I'm trying to write some code that will email someone depending upon
                        the existance of a value in my database. My code will search through the database and check for the values, but I'm not sure if I can email the person in my database, based on the current date being 30 days after their entry in the database. I'm kinda just getting used to php and I started out on Javascript. PHP is by far the best of the two.
                        Thanks 4 the great help!

                        Comment


                        • #13
                          Re: need help with form and php stuff

                          What you want to do is quite possible. Again, i don't understand what you mean with "but I'm not sure if I can email the person in my database, based on the current date being 30 days after their entry in the database"

                          You can check if a particular email or name or password exists in the database, and then email him if the above conditions are verified. If you need to have a mail sent out 30 days after one has signed up, there are two ways:

                          Manualy: each day you run a script that checks the signup dates, and if it finds someone that has signed up 30 days ago, it will email him.

                          Automatically: by setting up a cron job that will do the same thing for you once a day.

                          Please note that you will need at least a "flag" field, so the script will update the users details (with a field that indicates that the email has been sent to that user, in order to avoid sending out the email more than once)
                          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


                          • #14
                            Re: need help with form and php stuff

                            What is a "flag field"?

                            Comment


                            • #15
                              Re: need help with form and php stuff

                              I believe naval is just saying you need to mark a person in the database as having the email sent to them. You could just add an column with a default of 0 or FALSE, and then once the email is sent have the script update the column for that row to 1 or TRUE. And just have the script check that column if the value is 0 or 1, or FALSE or TRUE. This prevents people from getting 2 emails

                              Register/Login Script
                              Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

                              Comment

                              Working...
                              X