acicalla
asked on
Need help troublshooting form
I've got something wrong with my form where it's not updating the database when I click submit. I would like some help troubleshooting the form. I put the code for the page below.
<?php
session_start();
header("Cache-control: private");
if($_POST['UserName']!="" && $_POST['Password1']!="" && $_POST['Password2']!="" && $_POST['Email']!="" && $_POST['Name'] !="" && $_POST['Country'] !="" && $_POST['State'] !="" && $_POST['City'] !=""&& $_POST['ZipCode'] !="" && $_POST['Adress'] !="" && $_POST['phone']!="" && $_POST['company']!=="" && $_POST['checkbox']!="" && !($_POST['Country']==60 && $_POST['idtax']==""))
{
$errorMsg="";
include ("../dbase.php");
include ("../settings.php");
$replacevalues = array('&','/'," ","?","+","%","$","#","@") ;
$username=str_replace($rep lacevalues ,"", $_POST['UserName']);
$result = mysql_query("SELECT user FROM chatoperators WHERE user='$username'");
if (mysql_num_rows($result)== 1){
$errorMsg="Username exists, please choose another one!";
} else if($_POST['Password1']!=$_ POST['Pass word2']) {
$errorMsg="Passwords do not match";
}else if(strlen($_POST['Password 1'])<6){
$errorMsg="Passwords must be at least 6 characters long";
} else {
//user ID
$dateRegistered=time();
$currentTime=date("YmdHis" );
$userId=md5("$currentTime" .$_SERVER[ 'REMOTE_AD DR']);
$db_pass=md5($_POST['Passw ord1']);
$_SESSION['UID']=$userId;
$_SESSION['email']=$_POST[ 'Email'];
$_SESSION['password']=$_PO ST['Passwo rd1'];
$_SESSION['emailtype']=$_P OST['email type'];
if(mysql_query("INSERT INTO chatoperators VALUES ('$userId','$username', '".$_POST['Password1']."', '".$_POST['Email']."', '".$_POST['Name']."', '".$_POST['Country']."', '".$_POST['State']."','".$ _POST['Cit y']."', '".$_POST['ZipCode']."', '".$_POST['phone']."', '".$_POST['Adress']."', '".$_POST['PMethod']."', '".$_POST['PInfo']."', '$dateRegistered','$dateRe gistered', '0','0','5 00','pendi ng','$sope percentage ','".$_POS T['emailty pe']."','" .$_POST['c ompany']." ','".$_POS T['idtax'] ."')"))
{ } else { $errorMsg="Could not modify database(".mysql_error()." )";}
}//end if user exists
if ($errorMsg==""){
header ("Location: sopregistered.php");
$subject = "Your operator account activation at $siteurl";
if ($_POST['emailtype']=="tex t"){
$charset="Content-type: text/plain; charset=iso-8859-1\r\n";
$message = "Thank you for registering at $siteurl
In order to activate your newly created account copy and paste the link below in your browser:
$siteurl/actop.php?UID=$us erId
Once you activate your membership you will recieve a mail with your login information.
Thanks!
The Webmaster
This is an automated response, please do not reply!";
} else if($_POST['emailtype']=="h tml"){
$charset="Content-type: text/html; charset=iso-8859-1\r\n";
$message = "Thank you for registering at $siteurl
In order to activate your newly created account copy and paste the link below in your browser:
<a href='$siteurlactop.php?UI D=$userId' >$siteurla ctop.php?$ userId</a>
Once you activate your membership you will recieve a mail with your login information.
Thanks!
The Webmaster
This is an automated response, please do not reply!";
}else {
echo"Email Session variable not set";
}
mail($_SESSION['email'], $subject, $message,
"MIME-Version: 1.0\r\n".
$charset.
"From:$registrationemail\r \n".
"Reply-To:$registrationema il\r\n".
"X-Mailer: PHP/" . phpversion() );
}
}
else
{
$errorMsg="Please fill all the required fields.";
}
?>
<html>
<head>
<title>User Registration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
-->
</style>
<link href="../styles.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style4 {color: #CCCCCC}
body {
background-color: #000000;
}
.style1 {color: #FFFFFF}
.style2 {color: #666666}
.style5 {color: #999999}
.style6 {font-size: 10px}
-->
</style>
</head>
<TABLE BORDER="0" align="center" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD COLSPAN="7"><object classid="clsid:D27CDB6E-AE 6D-11cf-96 B8-4445535 40000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="720" height="201">
<param name="movie" value="../movie.swf">
<param name="quality" value="high">
<embed src="../movie.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockw ave-flash" width="720" height="201"></embed></obj ect></TD>
</TR>
<TR>
<TD colspan="7"> <table width="400" border="0" align="center">
<TR>
<td><a href="/index.php"><IMG SRC="../images/header_2.gi f" WIDTH="122" BORDER="0" HEIGHT="30"></a></td>
<TD><a href="/user.php"><IMG SRC="../images/header_3.gi f" WIDTH="78" BORDER="0" HEIGHT="30"></a></TD>
<TD><a href="/registration/model_ agree.php" ><IMG SRC="../images/header_4.gi f" BORDER="0" width="125" height="30"></a></TD>
<TD><a href="/login.php"><IMG SRC="../images/header_6.gi f" WIDTH="60" BORDER="0" HEIGHT="30"></a></TD>
<TD><a href="/faq.php"><IMG SRC="../images/header_7.gi f" WIDTH="44" BORDER="0" HEIGHT="30"></a></TD>
</TR>
</table></TD>
</TR>
</TABLE>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="52"><span class="big_title style4">Studio Operators registration Form</span><br>
<span class="small_title style4">As a Studio operator you will be able to add Models to your account, watch their actvity and earn money as they chat with our memebers. </span><span class="small_title"><br>
<span class="error">
<?php if ( isset($errorMsg) && $errorMsg!=""){ echo $errorMsg; } ?>
</span> </span></td>
</tr>
</table>
<form action="operator.php" method="post" enctype="multipart/form-da ta" name="form1" target="_self">
<table width="720" border="0" align="center" cellpadding="4" cellspacing="0">
<tr bgcolor="#9A0000">
<td colspan="3"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="form_header_title"> Step 1: User Information </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3" class="form_definitions">L ogin information. Your user will be a unique user.</td>
</tr>
<tr>
<td width="150" align="right" class="form_definitions">
<? if(isset($_POST['UserName' ]) && $_POST['UserName']==""){
echo "<font color=red>Username*</font> ";
} else{
echo"Username";
}?></td>
<td><input name="UserName" value="<? if (isset($_POST['UserName']) ){ echo $_POST['UserName']; } ?>" type="text" id="UserName" size="24" maxlength="24"></td>
<td width="296"> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['Password1 ']) && $_POST['Password1']==""){
echo "<font color=red>Password*</font> ";
} else{
echo"Password*";
}?> </td>
<td><input name="Password1" type="password" id="Password1" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['Password2 ']) && $_POST['Password2']==""){
echo "<font color=red>Password*</font> ";
} else{
echo"Password*";
}?> </td>
<td><input name="Password2" type="password" id="Password2" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['Email']) && $_POST['Email']==""){
echo "<font color=red>E-mail*</font>";
} else{ echo"E-mail*";}
?> </td>
<td><input name="Email" value="<? if (isset($_POST['Email'])){ echo $_POST['Email']; } ?>" type="text" id="Email" size="24" maxlength="50"></td>
<td><span class="form_informations"> Your email will not be visible to members and will not be discolsed to other parties. </span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr bgcolor="#930300">
<td colspan="3"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="form_header_title"> Step 2: Personal information</td>
</tr>
</table></td>
</tr>
<tr align="left">
<td colspan="3" class="form_definitions">< object classid="clsid:D27CDB6E-AE 6D-11cf-96 B8-4445535 40000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="140" height="24">
<param name="movie" value="topsecret.swf">
<param name="quality" value="high">
<embed src="topsecret.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockw ave-flash" width="140" height="24"></embed>
</object>
This informations are kept confidential and never displayed o disclose to others <br>
(internal use only).</td>
</tr>
<tr>
<td align="right" class="form_definitions">< ? if(isset($_POST['Name']) && $_POST['Name']==""){
echo "<font color=red>Full Name*</font>";
} else{ echo"Full Name*";}
?> </td>
<td><input name="Name" value="<? if (isset($_POST['Name'])){ echo $_POST['Name']; } ?>" type="text" id="Name" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">C ountry*</t d>
<td width="250">
<select name="Country" id="Country">
<?
include ("../dbase.php");
include ("../settings.php");
$result = mysql_query('SELECT * FROM countries ORDER BY name');
while($row = mysql_fetch_array($result) ) {
echo"<option value='$row[id]'";
if (isset($_POST['Country']) && $_POST['Country']==$row['i d']){
echo "selected";
}
echo ">$row[name]</option>";
}
?>
</select>
</td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">< ? if(isset($_POST['State']) && $_POST['State']==""){
echo "<font color=red>State*</font>";
} else{ echo"State*";}
?> </td>
<td><input name="State" value="<? if (isset($_POST['State'])){ echo $_POST['State']; } ?>" type="text" id="State" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['City']) && $_POST['City']==""){
echo "<font color=red>City*</font>";
} else{ echo"City*";}
?> </td>
<td><input name="City" value="<? if (isset($_POST['City'])){ echo $_POST['City']; } ?>" type="text" id="City" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['ZipCode'] ) && $_POST['ZipCode']==""){
echo "<font color=red>Zip Code*</font>";
} else{ echo"Zip Code*";}
?> </td>
<td><input name="ZipCode" value="<? if (isset($_POST['ZipCode'])) { echo $_POST['ZipCode']; } ?>" type="text" id="ZipCode" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['phone']) && $_POST['phone']==""){
echo "<font color=red>Phone Number*</font>";
} else{ echo"Phone Number*";}
?>
</td>
<td><input name="phone" value="<? if (isset($_POST['phone'])){ echo $_POST['phone']; } ?>" type="text" id="phone" size="24" maxlength="24"></td>
<td class="form_informations"> (999) 999-9999 </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['Adress']) && $_POST['Adress']==""){
echo "<font color=red>Street Adress*</font>";
} else{ echo"Street Adress*";}
?> </td>
<td><textarea name="Adress" cols="24" rows="5" id="Adress"><? if (isset($_POST['Adress'])){ echo $_POST['Adress']; } ?></textarea></td>
<td> </td>
</tr>
<tr>
<td align="right"><span class="form_definitions">
<? if(isset($_POST['company'] ) && $_POST['company']==""){
echo "<font color=red>Company*</font>" ;
} else{ echo"Company*";}
?>
</span></td>
<td><input name="company" value="<? if (isset($_POST['company'])) { echo $_POST['company']; } ?>" type="text" id="company" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right"><span class="form_definitions">
<? if(isset($_POST['taxid']) && $_POST['taxid']=="" && $_POST['Country']==60){
echo "<font color=red>Tax Id number (if US company)*</font>";
} else{ echo"Tax Id number (if US company)*";}
?>
</span></td>
<td><input name="taxid" value="<? if (isset($_POST['taxid'])){ echo $_POST['taxid']; } ?>" type="text" id="taxid" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr bgcolor="#970102">
<td colspan="3"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><span class="form_header_title"> Step 3: Recieve Money Info </span></td>
</tr>
</table></td>
</tr>
<tr align="left">
<td colspan="3" class="form_definitions">T his information will beused in order to send you the money. Money is sent once a month on the 24.</td>
</tr>
<tr>
<td align="right" class="form_definitions">P ayment Method</td>
<td><select name="PMethod" id="PMethod">
<option value="wu">Western Union</option>
<option value="wt">Wire Transfer</option>
</select></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">P ayment Information</td>
<td><textarea name="PInfo" cols="24" rows="5" id="PInfo"><? if (isset($_POST['PInfo'])){ echo $_POST['PInfo']; } ?></textarea></td>
<td> </td>
</tr>
<tr align="left" bgcolor="#970102">
<td colspan="3"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><span class="form_header_title"> Step 4: Complete your Studio Operator subscription </span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3" align="right"><div align="left"><span class="form_definitions">Y our account is automatically created and you can start chatting live right away. </span></div></td>
</tr>
<tr>
<td colspan="3" class="form_definitions">< ? if(!isset($_POST['checkbox '])) { echo "<font color=red>You must agree with the terms:</font><br>";
}?>
<input name="checkbox" type="checkbox" value="checkbox" <? if( isset($_POST['checkbox']) && $_POST['checkbox']=="check box"){echo "checked";}?>>
I Agree the Terms and Conditions. <a href="../terms.php" target="_blank" class="left">Read
the Terms and Conditions here. </a><br>
<br>
Send registration emails as::
<input name="emailtype" type="radio" value="text" checked>
Plain text
<input name="emailtype" type="radio" value="html">
Html</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value=" I Agree the Terms and Conditions"></td>
<td> </td>
</tr>
</table>
<p> </p>
</form>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0" class="form_definitions">
<tr>
<td align="center" bgcolor="#000000"><span class="style2">----------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----</span ></td>
</tr>
</table>
</body>
</html>
<?php
session_start();
header("Cache-control: private");
if($_POST['UserName']!="" && $_POST['Password1']!="" && $_POST['Password2']!="" && $_POST['Email']!="" && $_POST['Name'] !="" && $_POST['Country'] !="" && $_POST['State'] !="" && $_POST['City'] !=""&& $_POST['ZipCode'] !="" && $_POST['Adress'] !="" && $_POST['phone']!="" && $_POST['company']!=="" && $_POST['checkbox']!="" && !($_POST['Country']==60 && $_POST['idtax']==""))
{
$errorMsg="";
include ("../dbase.php");
include ("../settings.php");
$replacevalues = array('&','/'," ","?","+","%","$","#","@")
$username=str_replace($rep
$result = mysql_query("SELECT user FROM chatoperators WHERE user='$username'");
if (mysql_num_rows($result)==
$errorMsg="Username exists, please choose another one!";
} else if($_POST['Password1']!=$_
$errorMsg="Passwords do not match";
}else if(strlen($_POST['Password
$errorMsg="Passwords must be at least 6 characters long";
} else {
//user ID
$dateRegistered=time();
$currentTime=date("YmdHis"
$userId=md5("$currentTime"
$db_pass=md5($_POST['Passw
$_SESSION['UID']=$userId;
$_SESSION['email']=$_POST[
$_SESSION['password']=$_PO
$_SESSION['emailtype']=$_P
if(mysql_query("INSERT INTO chatoperators VALUES ('$userId','$username', '".$_POST['Password1']."',
{ } else { $errorMsg="Could not modify database(".mysql_error()."
}//end if user exists
if ($errorMsg==""){
header ("Location: sopregistered.php");
$subject = "Your operator account activation at $siteurl";
if ($_POST['emailtype']=="tex
$charset="Content-type: text/plain; charset=iso-8859-1\r\n";
$message = "Thank you for registering at $siteurl
In order to activate your newly created account copy and paste the link below in your browser:
$siteurl/actop.php?UID=$us
Once you activate your membership you will recieve a mail with your login information.
Thanks!
The Webmaster
This is an automated response, please do not reply!";
} else if($_POST['emailtype']=="h
$charset="Content-type: text/html; charset=iso-8859-1\r\n";
$message = "Thank you for registering at $siteurl
In order to activate your newly created account copy and paste the link below in your browser:
<a href='$siteurlactop.php?UI
Once you activate your membership you will recieve a mail with your login information.
Thanks!
The Webmaster
This is an automated response, please do not reply!";
}else {
echo"Email Session variable not set";
}
mail($_SESSION['email'], $subject, $message,
"MIME-Version: 1.0\r\n".
$charset.
"From:$registrationemail\r
"Reply-To:$registrationema
"X-Mailer: PHP/" . phpversion() );
}
}
else
{
$errorMsg="Please fill all the required fields.";
}
?>
<html>
<head>
<title>User Registration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
-->
</style>
<link href="../styles.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style4 {color: #CCCCCC}
body {
background-color: #000000;
}
.style1 {color: #FFFFFF}
.style2 {color: #666666}
.style5 {color: #999999}
.style6 {font-size: 10px}
-->
</style>
</head>
<TABLE BORDER="0" align="center" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD COLSPAN="7"><object classid="clsid:D27CDB6E-AE
<param name="movie" value="../movie.swf">
<param name="quality" value="high">
<embed src="../movie.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockw
</TR>
<TR>
<TD colspan="7"> <table width="400" border="0" align="center">
<TR>
<td><a href="/index.php"><IMG SRC="../images/header_2.gi
<TD><a href="/user.php"><IMG SRC="../images/header_3.gi
<TD><a href="/registration/model_
<TD><a href="/login.php"><IMG SRC="../images/header_6.gi
<TD><a href="/faq.php"><IMG SRC="../images/header_7.gi
</TR>
</table></TD>
</TR>
</TABLE>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="52"><span class="big_title style4">Studio Operators registration Form</span><br>
<span class="small_title style4">As a Studio operator you will be able to add Models to your account, watch their actvity and earn money as they chat with our memebers. </span><span class="small_title"><br>
<span class="error">
<?php if ( isset($errorMsg) && $errorMsg!=""){ echo $errorMsg; } ?>
</span> </span></td>
</tr>
</table>
<form action="operator.php" method="post" enctype="multipart/form-da
<table width="720" border="0" align="center" cellpadding="4" cellspacing="0">
<tr bgcolor="#9A0000">
<td colspan="3"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="form_header_title">
</tr>
</table></td>
</tr>
<tr>
<td colspan="3" class="form_definitions">L
</tr>
<tr>
<td width="150" align="right" class="form_definitions">
<? if(isset($_POST['UserName'
echo "<font color=red>Username*</font>
} else{
echo"Username";
}?></td>
<td><input name="UserName" value="<? if (isset($_POST['UserName'])
<td width="296"> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['Password1
echo "<font color=red>Password*</font>
} else{
echo"Password*";
}?> </td>
<td><input name="Password1" type="password" id="Password1" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['Password2
echo "<font color=red>Password*</font>
} else{
echo"Password*";
}?> </td>
<td><input name="Password2" type="password" id="Password2" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['Email']) && $_POST['Email']==""){
echo "<font color=red>E-mail*</font>";
} else{ echo"E-mail*";}
?> </td>
<td><input name="Email" value="<? if (isset($_POST['Email'])){ echo $_POST['Email']; } ?>" type="text" id="Email" size="24" maxlength="50"></td>
<td><span class="form_informations">
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr bgcolor="#930300">
<td colspan="3"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="form_header_title">
</tr>
</table></td>
</tr>
<tr align="left">
<td colspan="3" class="form_definitions"><
<param name="movie" value="topsecret.swf">
<param name="quality" value="high">
<embed src="topsecret.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockw
</object>
This informations are kept confidential and never displayed o disclose to others <br>
(internal use only).</td>
</tr>
<tr>
<td align="right" class="form_definitions"><
echo "<font color=red>Full Name*</font>";
} else{ echo"Full Name*";}
?> </td>
<td><input name="Name" value="<? if (isset($_POST['Name'])){ echo $_POST['Name']; } ?>" type="text" id="Name" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">C
<td width="250">
<select name="Country" id="Country">
<?
include ("../dbase.php");
include ("../settings.php");
$result = mysql_query('SELECT * FROM countries ORDER BY name');
while($row = mysql_fetch_array($result)
echo"<option value='$row[id]'";
if (isset($_POST['Country']) && $_POST['Country']==$row['i
echo "selected";
}
echo ">$row[name]</option>";
}
?>
</select>
</td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions"><
echo "<font color=red>State*</font>";
} else{ echo"State*";}
?> </td>
<td><input name="State" value="<? if (isset($_POST['State'])){ echo $_POST['State']; } ?>" type="text" id="State" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['City']) && $_POST['City']==""){
echo "<font color=red>City*</font>";
} else{ echo"City*";}
?> </td>
<td><input name="City" value="<? if (isset($_POST['City'])){ echo $_POST['City']; } ?>" type="text" id="City" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['ZipCode']
echo "<font color=red>Zip Code*</font>";
} else{ echo"Zip Code*";}
?> </td>
<td><input name="ZipCode" value="<? if (isset($_POST['ZipCode']))
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['phone']) && $_POST['phone']==""){
echo "<font color=red>Phone Number*</font>";
} else{ echo"Phone Number*";}
?>
</td>
<td><input name="phone" value="<? if (isset($_POST['phone'])){ echo $_POST['phone']; } ?>" type="text" id="phone" size="24" maxlength="24"></td>
<td class="form_informations">
</tr>
<tr>
<td align="right" class="form_definitions">
<? if(isset($_POST['Adress'])
echo "<font color=red>Street Adress*</font>";
} else{ echo"Street Adress*";}
?> </td>
<td><textarea name="Adress" cols="24" rows="5" id="Adress"><? if (isset($_POST['Adress'])){
<td> </td>
</tr>
<tr>
<td align="right"><span class="form_definitions">
<? if(isset($_POST['company']
echo "<font color=red>Company*</font>"
} else{ echo"Company*";}
?>
</span></td>
<td><input name="company" value="<? if (isset($_POST['company']))
<td> </td>
</tr>
<tr>
<td align="right"><span class="form_definitions">
<? if(isset($_POST['taxid']) && $_POST['taxid']=="" && $_POST['Country']==60){
echo "<font color=red>Tax Id number (if US company)*</font>";
} else{ echo"Tax Id number (if US company)*";}
?>
</span></td>
<td><input name="taxid" value="<? if (isset($_POST['taxid'])){ echo $_POST['taxid']; } ?>" type="text" id="taxid" size="24" maxlength="24"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr bgcolor="#970102">
<td colspan="3"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><span class="form_header_title">
</tr>
</table></td>
</tr>
<tr align="left">
<td colspan="3" class="form_definitions">T
</tr>
<tr>
<td align="right" class="form_definitions">P
<td><select name="PMethod" id="PMethod">
<option value="wu">Western Union</option>
<option value="wt">Wire Transfer</option>
</select></td>
<td> </td>
</tr>
<tr>
<td align="right" class="form_definitions">P
<td><textarea name="PInfo" cols="24" rows="5" id="PInfo"><? if (isset($_POST['PInfo'])){ echo $_POST['PInfo']; } ?></textarea></td>
<td> </td>
</tr>
<tr align="left" bgcolor="#970102">
<td colspan="3"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><span class="form_header_title">
</tr>
</table></td>
</tr>
<tr>
<td colspan="3" align="right"><div align="left"><span class="form_definitions">Y
</tr>
<tr>
<td colspan="3" class="form_definitions"><
}?>
<input name="checkbox" type="checkbox" value="checkbox" <? if( isset($_POST['checkbox']) && $_POST['checkbox']=="check
I Agree the Terms and Conditions. <a href="../terms.php" target="_blank" class="left">Read
the Terms and Conditions here. </a><br>
<br>
Send registration emails as::
<input name="emailtype" type="radio" value="text" checked>
Plain text
<input name="emailtype" type="radio" value="html">
Html</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value=" I Agree the Terms and Conditions"></td>
<td> </td>
</tr>
</table>
<p> </p>
</form>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0" class="form_definitions">
<tr>
<td align="center" bgcolor="#000000"><span class="style2">-----------
</tr>
</table>
</body>
</html>
ASKER
also the error from the form is please fill all required fields, even though they are all filled.
Hi,
You are using $_POST['idtax'] while you have <input name="taxid" ../>
As suggestion I would also change
if($_POST['UserName'] != "" .. etc
into
if(!empty($_POST['UserName ']) && !empty($_POST['Password1'] ) && !empty($_POST['Passwprd2'] )
Alternatively you can use this:
$required = array('UserName','Password 1','Passwo rd2');
$failed = 0;
foreach($required as $field) {
if(empty($_POST[$field])) $failed++;
}
if($failed == 0) {
}
Also you would have to change your output to use htmlspecialchars:
<input name="Name" value="<?php if(!empty($_POST['Name'])) { echo htmlspecialchars($_POST['N ame']);}?> "
Kind regards
-r-
You are using $_POST['idtax'] while you have <input name="taxid" ../>
As suggestion I would also change
if($_POST['UserName'] != "" .. etc
into
if(!empty($_POST['UserName
Alternatively you can use this:
$required = array('UserName','Password
$failed = 0;
foreach($required as $field) {
if(empty($_POST[$field])) $failed++;
}
if($failed == 0) {
}
Also you would have to change your output to use htmlspecialchars:
<input name="Name" value="<?php if(!empty($_POST['Name']))
Kind regards
-r-
ASKER
ok, the form is submitting and updating the database if I make the idtax. taxid change.
Even though it updated the database it did not send me to sopregistered.php after the database was updated like it should. The sopregistered.php file is in the same directory.
If I make the other change you suggested
if(!empty($_POST['UserName ']) && !empty($_POST['Password1'] ) && !empty($_POST['Passwprd2'] )
it breaks the code on line 8.
Even though it updated the database it did not send me to sopregistered.php after the database was updated like it should. The sopregistered.php file is in the same directory.
If I make the other change you suggested
if(!empty($_POST['UserName
it breaks the code on line 8.
The if(!empty() structure was a partial example, not a full line. You have to make sure that you have an additional closing anchor at the end:
if( !empty($_ POST['UserName']) && !empty($_POST['Password1'] ) && .... && !empty($_POST['taxid']) ) {
//code.
}
As to your question on the header redirect, I am not fully sure which earlier line might be preventing the redirect.
Try starting your code with:
<?php
error_reporting(E_ALL);
ini_set('display_errors',1 );
session_start();
Kind regards,
-r-
if( !empty($_ POST['UserName']) && !empty($_POST['Password1']
//code.
}
As to your question on the header redirect, I am not fully sure which earlier line might be preventing the redirect.
Try starting your code with:
<?php
error_reporting(E_ALL);
ini_set('display_errors',1
session_start();
Kind regards,
-r-
ASKER
I entered that previous line like this
if(!empty($_POST['UserName ']) && !empty($_POST['Password1'] ) && !empty($_POST['Passwprd2'] ) && !empty($_POST['Email'])&& !empty($_POST['Name'])&& !empty($_POST['country'])& & !empty($_POST['State'])&& !empty($_POST['City'])&& !empty($_POST['Zipcode'])& & !empty($_POST['Address'])& & !empty($_POST['phone'])&& !empty($_POST['company'])& & !empty($_POST['checkbox']) && !($_POST['Country']==60 && !empty($_POST['taxid'])){
When I got the error.
also I entered this
error_reporting(E_ALL);
ini_set('display_errors',1 );
and I don't any error back. It just updates the account sends the email and returns back to the same page.
if(!empty($_POST['UserName
When I got the error.
also I entered this
error_reporting(E_ALL);
ini_set('display_errors',1
and I don't any error back. It just updates the account sends the email and returns back to the same page.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the help!!! That last exit fixed the redirect as well.
Yes, but is the email still being send? The email sending code is executed after the header-redirect isn't it?
-r-
-r-
ASKER