need help with form and php stuff

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • navaldesign
    General & Forum Moderator

    • Oct 2005
    • 12080

    #16
    Re: need help with form and php stuff

    Exactly. "Flags" are just pointers set to "True" or "False" (or, which is the same, "1" or "O", "Sent" or "Not Sent", anything that indicates the fullfilment of a condition or not.
    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

    • horus
      Sergeant

      • Jan 2007
      • 29

      #17
      Re: need help with form and php stuff

      Hey, it's me again. I'm having challenges with making my code submit user input into the DB. I know that the insertion takes place in the function addNewUser() , but for some strange reason, after it tests the input (checkboxes) and echoes the proper response, I call the function and it refreshes the page, but does not submit the input fields to the DB.

      Here's the code:

      <?
      session_start();
      include("database.php");
      $date = date("Y/m/d");

      //see if name already exists in database
      function Name_Exists($Name){
      global $conn;
      if(!get_magic_quotes_gpc()){
      $Name = addslashes($Name);
      }
      $q = "select Name from members where Name = '$Name'";
      $result = mysql_query($q,$conn);
      return (mysql_numrows($result) > 0);
      }

      /**
      * Inserts the given
      * into the database. Returns true on success,
      * false otherwise.
      */
      function addNewUser($Name, $Phone, $Email, $State, $City, $Address, $Address2, $Referredby, $date){
      global $conn;
      $q = "INSERT INTO members VALUES ('$Name', '$Phone', '$Email' , '$State' , '$City' , '$Address' , '$Address2' , '$Referredby', '$date')";
      return mysql_query($q,$conn);
      }

      /**
      * Determines whether or not to show to sign-up form
      * based on whether the form has been submitted, if it
      * has, check the database for consistency and create
      * the new account.
      */
      if(isset($_POST['submit'])){
      /* Make sure all fields were entered */
      if(!$_POST['name'] || !$_POST['phone'] || !$_POST['email'] || !$_POST['state'] || !$_POST['city'] || !$_POST['address']){
      die('You didn\'t fill in a required field.');
      }

      /* Spruce up username, check length */
      $_POST['name'] = trim($_POST['name']);
      $_POST['phone'] = trim($_POST['phone']);
      $_POST['email'] = trim($_POST['email']);
      $_POST['state'] = trim($_POST['state']);
      $_POST['city'] = trim($_POST['city']);
      $_POST['address'] = trim($_POST['address']);
      $_POST['address2'] = trim($_POST['address2']);
      $_POST['referredby'] = trim($_POST['referredby']);

      if(Name_Exists($_POST['name'])){
      $use = $_POST['name'];
      die("Sorry, the name: <strong>$use</strong> already exists in our records.");
      }


      $OK = 0;
      if(!$_POST['over_18'] || !$_POST['incomesource'] || !$_POST['checkingaccount'] || !$_POST['savingsaccount'] || !$_POST['legalservices'] || !$_POST['idt'] || !$_POST['compaccess'] || !$_POST['inetaccess'] || !$_POST['refer'] || !$_POST['oneyear'] || !$_POST['lessons'] || !$_POST['iagree']){
      echo "<p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <img src='coach2 update copy.jpg' align='top' border='0' width='71' height='88' style='position:absolute;left:20px;top:3px;width:7 1px;height:88px;z-index:'>
      <div style='position:absolute;left:110px;top:12px;width :324px;height:55px;z-index:' align='left'>
      <font style='font-size:48px' color='#000000' face='Eras Demi ITC'><b>CreditCoach</font><font style='font-size:24px' color='#000000' face='Eras Demi ITC'></b>™</font></div>
      <div style='position:absolute;left:64px;top:56px;width: 409px;height:33px;z-index:' align='center'>
      <font style='font-size:21px' color='#000000' face='Papyrus'><b>We help you reach financial success</b></font></div>";
      $OK = 1;
      }
      else{
      echo "<p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <img src='coach2 update copy.jpg' align='top' border='0' width='71' height='88' style='position:absolute;left:20px;top:3px;width:7 1px;height:88px;z-index:'>
      <div style='position:absolute;left:110px;top:12px;width :324px;height:55px;z-index:' align='left'>
      <font style='font-size:48px' color='#000000' face='Eras Demi ITC'><b>CreditCoach</font><font style='font-size:24px' color='#000000' face='Eras Demi ITC'></b>™</font></div>
      <div style='position:absolute;left:64px;top:56px;width: 409px;height:33px;z-index:' align='center'>
      <font style='font-size:21px' color='#000000' face='Papyrus'><b>We help you reach financial success</b></font></div>
      <p>&nbsp;</p><p align='left'><u><font color='#FF0000'>
      <a href='http://www.youronlinecreditcoach.com/register.php'>
      <font color='#FF0000' size='4' face='Arial'>Continue</font></a></font></u><font size='4' face='Arial'><br>&nbsp;</font></p>";
      $OK = 1;
      }
      if(!$_POST['over_18']){
      echo "<p><br>
      <font size='4'face='Arial'>You must be a legal adult, over 18, to participate in our
      programs. <br>
      Please reapply when you are of legal age, 18 and over.</font></p>";
      }
      if(!$_POST['incomesource']){
      echo "<p><br>
      <font size='4' face='Arial'>You must be currently employed or have a reliable
      source of income to participate in our programs. <br>
      In order to maintain good financial health, you must have an income that will
      enable you to keep up with your<br>
      financial obligations.</font></p>";
      }
      if(!$_POST['checkingaccount']){
      echo "<p><font size='4' face='Arial'>You must have an active checking account to
      participate in our programs. When dealing with lenders, <br>
      you must be able to prove that you can effectively handle your finances. A
      checking account shows financial stability. You can open a free checking account with $20 or
      less at Washington Mutual Bank.<br>
      &nbsp;</font></p>";
      }
      if(!$_POST['savingsaccount']){
      echo "<p><font size='4' face='Arial'>You must have an open savings account to
      participate in our programs. <br>
      A large part of our program is tailored towards strategic saving techniques.</font></p>";
      }
      if(!$_POST['legalservices']){
      echo "<p><font face='Arial' size='4'>You must have a legal services plan to
      participate in our programs. <br>
      Because these programs deal with using your legal rights, it is very <br>
      important to have your own attorney by your side.</font></p>";
      }
      if(!$_POST['idt']){
      echo "<p><font face='Arial' size='4'>You must have an identity theft protection plan
      to participate in our<br>
      programs. It is important to have protection in place for your credit as <br>
      well as your financial identity, as you go through this process.</font></p>";
      }

      if(!$_POST['compaccess'] || !$_POST['inetaccess']){
      echo "<p><font face='Arial' size='4'>You must have access to a computer with internet
      access to participate in <br>
      our programs. These programs are website-based and require access to the
      internet. <br>
      Your local library may provide free computer usage for it’s members.</font></p>";
      }
      if(!$_POST['refer']){
      echo "<p><font size='4' face='Arial'>In order to participate in these programs you
      must agree to refer at least 3<br>
      people into the program that also become members. The programs are FREE because
      <br>
      the CreditCoach™ Team wants to help as many people as possible and we want our
      <br>
      participants to want to help others as well.</font></p>";
      }
      if(!$_POST['oneyear']){
      echo "<p><font face='Arial' size='4'>Each member must commit to a one (1) year
      membership in order to <br>
      participate in our programs. The CreditCoach™ system is made up of <br>
      three distinct programs, which take some time to complete. This program <br>
      may not be the right fit for those who want a quick fix. It is designed to <br>
      assist those who are willing to make a commitment to developing a healthy
      financial future.</font></p>";
      }
      if(!$_POST['lessons']){
      echo "<p><font face='Arial' size='4'>In order to participate in these programs you
      must commit to doing the <br>
      tutorials, lessons and projects required. This program is designed to <br>
      assist others, but only if they are willing to help themselves. If you <br>
      are unwilling to do the work, this program is not for you.</font></p>";
      }
      if(!$_POST['iagree']){
      echo "<p><font face='Arial' size='4'>You <u>must</u> agree to the terms and conditions to become a member.</font></p>";
      }


      //Continue to registration
      if((!$_POST['checkingaccount'] || !$_POST['savingsaccount'] || !$_POST['legalservices'] || !$_POST['idt'] || !$_POST['compaccess'] || !$_POST['inetaccess']) && ($_POST['over_18'] && $_POST['incomesource'] && $_POST['refer'] && $_POST['oneyear'] && $_POST['lessons'])){
      echo "<p align='left'><u><font color='#FF0000'>
      <a href='http://www.youronlinecreditcoach.com/register.php'>
      <font color='#FF0000' size='4' face='Arial'>Continue</font></a></font></u><font size='4' face='Arial'><br>&nbsp;</font></p>";
      }
      /* Add the new account to the database */

      $_SESSION['reguname'] = $_POST['name'];
      $_SESSION['regresult'] = addNewUser($_POST['name'], $_POST['phone'], $_POST['email'], $_POST['state'], $_POST['city'], $_POST['address'], $_POST['address2'], $_POST['referredby'], $date);
      $_SESSION['registered'] = true;
      echo "<meta http-equiv=\"Refresh\" url=$HTTP_SERVER_VARS[PHP_SELF]\">";
      return;
      }
      ?>

      Thanx for your assistance. :)

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #18
        Re: need help with form and php stuff

        Which one is the form that submits to this script ? check field names to see if there is a problem with field naming.
        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

        • horus
          Sergeant

          • Jan 2007
          • 29

          #19
          Re: need help with form and php stuff

          The problem is not in the field names. All field names are correct.
          Here's the link to the form.



          It echoes the message, but does not submit.

          Comment

          • virize
            Private First Class

            • Nov 2007
            • 7

            #20
            Re: need help with form and php stuff

            Originally posted by horus View Post
            The problem is not in the field names. All field names are correct.
            Here's the link to the form.



            It echoes the message, but does not submit.
            hey horus!

            i visited your site to check out what you were talking about. im currently building mine, however, im stuck on how to have a login page. Or better yet, i'd like to know how to create a form in which the only way they can get in is by a designated user/pass.

            i noticed you have a member login page. can you please assist me in the process of creating one? thanks!

            Comment

            • navaldesign
              General & Forum Moderator

              • Oct 2005
              • 12080

              #21
              Re: need help with form and php stuff

              A member login script is not easy to explain how to create. It requires at least 3 - 4 pages (Login, Register, Edit Profile, Forgot Password, confirmation pages, error pages, activation page, etc) , 3 - 4 backed scripts (the scripts that will validate and process all the user input during registration or login or editing profile or requiring forgotten details etc) as well as a Database interface for the site Administrator to be able to manage the users. Unless you have php/mysql coding experience, i would say that it is practically impossible to do this in a short (short = some days) time.

              So you actually have two options: either find a script on the net (free or paid for) OR have one made for you. It really depends on what your needs for customization are.

              Have a look at http://www.dbtechnosystems.com/logginexamples.php for a login script demo
              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

              • carpedeim
                Private

                • Dec 2007
                • 3

                #22
                Re: need help with form and php stuff

                Hi I need help too I have constructed my form watched the tutorials more than twice - but when I come to cut and paste the php code in page html its not there - any idea what I am doing wrong?

                thanks

                Comment

                • navaldesign
                  General & Forum Moderator

                  • Oct 2005
                  • 12080

                  #23
                  Re: need help with form and php stuff

                  The code is in the Tutorial. Scroll down the tutorial, under the video, and you will find step by step instructions. Also you will find the necessary code. Copy it from there, edit it, and paste it in your page.

                  That's 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

                  • carpedeim
                    Private

                    • Dec 2007
                    • 3

                    #24
                    Re: need help with form and php stuff

                    Thanks for this I will give that a try - as a complete novice its great to get this sort of support

                    many thanks again

                    Comment

                    Working...
                    X