Jump to content

Recommended Posts

I don't know exactly what is wrong with my form2.inc.php, it doesn't insert into my database. When i click on submit, it checks for errors in the fields, and if all is fine, it doesn't show any confirmation message.

 

Below are the codes

 

<?php
$intForm = (isset($intForm)) ? $intForm : 1;

if ($intForm == 1)
{
include("form1.inc.php");
}

if ($intForm == 2)
{
include("form2.inc.php");
}

?>

applys.php

 

<?php
include("connect.php");

$tabsubmit=true;
$oktab=false;
$msg="Final Step";


if($sub2){

if(trim($PasswordChallenge)==""){
$msg='Check Challenge Question Error';
}

if(trim($PasswordResponse)==""){
$msg='Check Answer Field Error';
}

if(trim($account_key)==""){
$msg='Check Pin Error';

}
if($account_key!=$account_key2){
$msg='Account Pin does not Match';
}
if($PasswordResponse!=$PasswordResponse2){
$msg='Challenge Question Answers does not Match';
}

else if(($PasswordChallenge) && ($PasswordResponse) && ($account_key) &&($account_key=$account_key2) && ($PasswordResponse!=$PasswordResponse2)){

$sqlsub=mysql_query("insert into test(account_key,PasswordChallenge,PasswordResponse)values('$account_key','$PasswordChallenge','$PasswordResponse')");
}
if($sqlsub){
$msg="Thank you for your application. We will contact you shortly.";
$tabsubmit=false;
$oktab=true;
$mailmsg="$hello $surname\n$Reg_Mail_MSG\nAccount ID:$account_id\nAccount Key:$account_key\nEmail:$email\nAccount Type:$account_type\n\n\n$host<br>$our_team";
$send_mail= mail ($email,$Reg_Mail_subject,$mailmsg, "From: $adminmail");
}
}



include("includes/top_head.php");
include("includes/header.php");
?>

<div id="cont">
<?php if($tabsubmit){ ?>
<h3 align="center"><font color="#990000"><?php echo $msg; ?></font></h3>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" name="myform">
<input type="hidden" name="intForm" value="2">
<?php
foreach ($_POST as $strKey => $strValue)
{
echo "<input type='hidden' name='{$strValue}' value='{$strValue}'>";
}

?>

<table width="543" border="1" align="center" bordercolor="#CFD9E2" class="story">
          <tr>
            <td height="37" colspan="2" bgcolor="#cfd9e2" class="formfont"><span style="font-size:10pt; color:#000000;font-weight:bold;">Create a User Name & Password: </span></td>
          </tr>
          <tr>
            <td><div align="right"><strong>* PIN Code:</strong></div></td>
            <td width="353"><input name="account_key" type="password" id="account_key" value="<?php echo"$account_key2"; ?>" tabindex="301" size="30" maxlength="4"> 
            (4 Digits ONLY) </td>

          </tr>
          <tr>
            <td><div align="right"><strong>* Verify PIN Code: </strong></div></td>
            <td><input name="account_key2" type="password" id="account_key2" tabindex="301" size="30" maxlength="4">
(4 Digits ONLY) </td>
          </tr>
          <tr>
            <td><div align="right"><strong>* Challenge Question </strong></div></td>

            <td><input name="PasswordChallenge" type="text" id="PasswordChallenge" size="30" value="<?php echo"$PasswordChallenge"; ?>" maxlength="50" tabindex="303" ></td>
          </tr>
          <tr>
            <td><div align="right"><strong>* Answer</strong></div></td>
            <td><input name="PasswordResponse" type="text" id="PasswordResponse" tabindex="303" value="<?php echo"$PasswordResponse"; ?>" size="30" maxlength="30" ></td>
          </tr>
          <tr>
            <td><div align="right"><strong> * Verify Answer </strong></div></td>

            <td><input name="PasswordResponse2" type="text" id="PasswordResponse2" size="30" maxlength="30" value="<?php echo"$PasswordResponse2"; ?>" tabindex="303" ></td>
          </tr>
        </table>
	     <p align="center">
          <input name="sub2" type="submit" id="sub2" tabindex="303" value="Submit">
          <input type="reset" name="Reset" value="Reset" tabindex="303" >
	  <br />
	    <?php } if($oktab){  ;
				  print "Thank you for your application. We will contact you shortly."; 
				  }					  
				  ?> 
</p>
      </form>
  
</div>

      <?php
  
  include("includes/footer.php");
  
  ?>
  
  </BODY>
  </HTML>
  

 

form2.inc.php

 

The database insert is in form2.inc.php. The error should be coming from there.

Link to comment
https://forums.phpfreaks.com/topic/111106-solved-database-insert-error/
Share on other sites

Dont make files with 2 dots. Not a good idea. just make it form1inc.php. Not saying thats the answer, but it'll get you out of trouble in the future.

 

 

Also...

 

someone should respond please

 

isn't the right way to approach a FREE forum for php help. Especially since it's only been a day and a half since you posted it. Have patience.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.