php forms

Status
Not open for further replies.

TarinC

New Member
Messages
698
Reaction score
0
Points
0
PHP:
<?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
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
:-/ *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:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
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:
<?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:

TarinC

New Member
Messages
698
Reaction score
0
Points
0
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:
<?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");
?>
 
Status
Not open for further replies.
Top