+ Reply to Thread
Results 1 to 24 of 24

Thread: need help with form and php stuff
      
   

  1. #1
    luckypenny is offline Private
    Join Date
    May 2007
    Posts
    1

    Default 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. #2
    AmaDee is offline Colonel
    Join Date
    Jun 2006
    Location
    Stone Mountain, GA
    Posts
    851

    Default 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.

  3. #3
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  4. #4
    horus is offline Sergeant
    Join Date
    Jan 2007
    Posts
    29

    Exclamation 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!

  5. #5
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  6. #6
    horus is offline Sergeant
    Join Date
    Jan 2007
    Posts
    29

    Talking 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?

  7. #7
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  8. #8
    horus is offline Sergeant
    Join Date
    Jan 2007
    Posts
    29

    Exclamation 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

  9. #9
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  10. #10
    horus is offline Sergeant
    Join Date
    Jan 2007
    Posts
    29

    Talking 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.

  11. #11
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  12. #12
    horus is offline Sergeant
    Join Date
    Jan 2007
    Posts
    29

    Talking 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!

  13. #13
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  14. #14
    horus is offline Sergeant
    Join Date
    Jan 2007
    Posts
    29

    Question Re: need help with form and php stuff

    What is a "flag field"?

  15. #15
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default 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

  16. #16
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  17. #17
    horus is offline Sergeant
    Join Date
    Jan 2007
    Posts
    29

    Exclamation 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. :)

  18. #18
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  19. #19
    horus is offline Sergeant
    Join Date
    Jan 2007
    Posts
    29

    Question 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.

    http://www.youronlinecreditcoach.com...tionnaire2.php

    It echoes the message, but does not submit.

  20. #20
    virize is offline Private First Class
    Join Date
    Nov 2007
    Posts
    7

    Default Re: need help with form and php stuff

    Quote 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.

    http://www.youronlinecreditcoach.com...tionnaire2.php

    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!

  21. #21
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  22. #22
    carpedeim is offline Private
    Join Date
    Dec 2007
    Posts
    3

    Default 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

  23. #23
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default 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!


  24. #24
    carpedeim is offline Private
    Join Date
    Dec 2007
    Posts
    3

    Default 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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49