Closed Thread
Results 1 to 8 of 8

Thread: php forms

  1. #1
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    php forms

    PHP Code:
    <?php
    if (!defined('MODULE_FILE')) {
     die (
    "You can't access this file directly...");
    }
    require_once(
    "mainfile.php");
    $module_name basename(dirname(__FILE__));
    $index 1;
    $subject "$sitename Free Admin Form";
    include(
    "header.php");
    $form_block "
     <center><font class=\"title\"><b>
    $sitename: Free Admin Form</b></font><br><br>
     <FORM ACTION=\"modules.php?name=Free_Admin&file=form\" METHOD=\"post\">
     <P>I Agree With The Terms And Conditions Stated Above And Understand That If Any Are Broken My Admin Will Be Removed!<br>
     <INPUT NAME=\"terms\" TYPE=\"radio\" VALUE=\"Agree\">I Agree<br>
     <INPUT NAME=\"terms\" TYPE=\"radio\" VALUE=\"Disagree\" CHECKED>I Disagree 
     <P><INPUT TYPE=\"submit\" VALUE=\"Continue\">
     </FORM></center>
    "
    ;
    OpenTable();
    if (
    $terms != "Disagree") {
     echo 
    "$form_block";
    } elseif (
    $terms == "") {
     if (
    $terms == "") {
      
    $name_err "<center><font class=\"option\"><b><i>ERROR: You MUST Agree With Terms And Conditions!</i></b></font></center><br>";
      
    $send "no";
     } elseif (
    $send == "no") {
      
    OpenTable2();
      echo 
    "$name_err";
      
    CloseTable2();
      echo 
    "<br><br>";
      echo 
    "$form_block";
     }
    }
    CloseTable();
    include(
    "footer.php");
    ?>
    Can some one fix this? its supposed to work like this: if you agree u go to the form action. and if u disagree u see the error

  2. #2
    Bryon is online now Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: php forms

    :-/ *long drawn out sigh*

    Hold-dd-dd on.

    Edit: Quick question. Well two. What file do you want the page to go to when the user clicks "Agree"? Also, what is the current page name (Script name.. whatever)?
    Last edited by Bryon; 01-12-2006 at 04:16 PM.

  3. #3
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    Re: php forms

    its on php-nuke. the file name i posted was index.php. (module name: Free_Admin)

    when people press agree this is where i want them to go:
    http://tps.x10hosting.com/tps/module...Admin/form.php (Cant be accessed directly)
    http://tps.x10hosting.com/tps/module...dmin&file=form (Have to be registered... to see...)
    Last edited by TarinC; 01-12-2006 at 04:24 PM.

  4. #4
    Bryon is online now Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: php forms

    Ok..

    Well, I am a little confused with the way this is all set up for you. I didn't know how to have it "go to the next page" if the user selected "I Agree" and emit and error if they didn't but not go to the next page. I ended up using javascript to "move the page" to the next if they click "I Agree", after the check on that is made.

    Now though, if someone goes to it and clicks "I Agree" it takes them to the next page, but when it does I get "You can't access this file directly...", so I don't know what the actual page is the script needs to "move on" to.

    Anwyays, here is what I changed it to. I just made some changes with the if statements and aligning:

    PHP Code:
    <?php



    if (!defined('MODULE_FILE')) {
     die (
    "You can't access this file directly...");
    }

       require_once(
    "mainfile.php");

       
    $module_name basename(dirname(__FILE__));
       
    $index 1;
       
    $subject $sitename .' Free Admin Form';

       include(
    "header.php");

       
    $form_block '
          <center><font class="title"><b>'
    $sitename .': Free Admin Form</b></font><br><br>
          <form action="'
    $PHP_SELF .'?name=Free_Admin&file=form" method="post">
          <p>I Agree With The Terms And Conditions Stated Above And Understand That If Any Are Broken My Admin Will Be Removed!</p>
          <input name="terms" type="radio" value="Agree">I Agree<br>
          <input name="terms" type="radio" value="Disagree" checked>I Disagree 
          <p><input type="submit" name="submit" value="Continue"></p>
          </form></center>
       '
    ;

       if (
    $_POST['submit']) {

       
    OpenTable();

          if (
    $_POST['terms'] == "Agree") {
             echo 
    '<script type="text/javascript"> window.location="http:tps.x10hosting.com/tps/modules/Free_Admin/form.php"; </script>';
          }
          elseif (
    $_POST['terms'] != "Agree") {
             
    $name_err '<center><font class="option"><b><i><b>ERROR</b>: You MUST Agree With Terms And Conditions!</i></b></font></center><br />';
             
    $send 'No';
          }
          elseif (
    $_POST['terms'] == "") {
             
    $name_err '<center><font class="option"><b><i><b>ERROR</b>: You MUST Agree With Terms And Conditions!</i></b></font></center><br />';
             
    $send 'No';
          }

          if (
    $send == 'No') {
             
    OpenTable2();
             echo 
    $name_err;
             
    CloseTable2();
             echo 
    '<br /><br />';
             echo 
    $form_block;
          }

          
    CloseTable();

       } else {
          echo 
    $form_block;
       }

       include(
    "footer.php");
    ?>
    Last edited by Bryon; 01-12-2006 at 04:38 PM.

  5. #5
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    Re: php forms

    i tried it.... it does the same thing. i click on disagree but it still does the same thing as agree.

    test it out here:
    http://www.tps.x10hosting.com/tps/modules.php?name=Test

  6. #6
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    Re: php forms

    sorry for double posting..

    Ive fixed the form so that if u disagree it will show the error... but now when u accept it doesnt do anything.. it just refreshes the screen. can u fix it?

    PHP Code:
    <?php
    if (!defined('MODULE_FILE')) {
     die (
    "You can't access this file directly...");
    }
    require_once(
    "mainfile.php");
    $module_name basename(dirname(__FILE__));
    $index 1;
    $subject "$sitename Free Admin Form";
    include(
    "header.php");
    $form_block "
     <center><font class=\"title\"><b>
    $sitename: Free Admin Form</b></font><br><br>
     <FORM ACTION=\"modules.php?name=Free_Admin\" METHOD=\"post\">
     <P>I Agree With The Terms And Conditions Stated Above And Understand That If Any Are Broken My Admin Will Be Removed!<br>
     <INPUT NAME=\"terms\" TYPE=\"radio\" VALUE=\"agree\">I Agree<br>
     <INPUT NAME=\"terms\" TYPE=\"radio\" VALUE=\"disagree\" CHECKED>I Disagree 
     <INPUT type=\"hidden\" name=\"opi\" value=\"ds\">
     <P><INPUT TYPE=\"submit\" VALUE=\"Continue\">
     </FORM></center>
    "
    ;
    OpenTable();
    if (
    $opi != "ds") {
     echo 
    "$form_block";
    } elseif (
    $opi == "ds") {
     if (
    $game_name == "") {
      
    $name_err "<center><font class=\"option\"><b><i>ERROR: You MUST Agree With Terms And Conditions!</i></b></font></center><br>";
      
    $send "no";
     }
     if (
    $send != "no") {
      
    $handle fopen("http://www.tps.roxr.com/beta/modules.php?name=Free_Admin&file=form""r+");
     } elseif (
    $send == "no") {
      
    OpenTable2();
      echo 
    "$name_err";
      
    CloseTable2();
      echo 
    "<br><br>";
      echo 
    "$form_block";
     }
    }
    CloseTable();
    include(
    "footer.php");
    ?>

  7. #7
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    Re: php forms

    I fixed it!

    Close this thread please!

  8. #8
    Phil is offline Retired Staff Phil is an unknown quantity at this point
    Join Date
    Aug 2005
    Location
    kingston, Ontairo, Canada
    Posts
    3,672

    Re: php forms

    OK I guess I can close this.

Closed Thread

Similar Threads

  1. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  2. tons of PHP Resources
    By Chris S in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 01-16-2009, 10:07 AM
  3. [PHP] PHP For Starters
    By Complex in forum Tutorials
    Replies: 24
    Last Post: 06-14-2008, 11:40 PM
  4. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers