Jump to content

Error message "Regtype" Field


gavenf

Recommended Posts

I have been trying to set up a registration form for my website and I have the following error message pop up when I fill in the form:

 

Please enter a value for te "regtype" field

 

My html page is below and below that is my register.php page.

 

I think the problem is the selection box for the Type of registration.

 

Any assistance would be great.

 

 

Register.html

<HTML>
<HEAD>
<TITLE>Registration</TITLE>

<script Language="JavaScript">
<!--
function Form1_Validator(theForm)
{
  	if (theForm.regtype.value == "")
  {
    alert("Please enter a value for the \"regtype\" field.");
    theForm.regtype.focus();
    return (false);
  }
  	if (theForm.firstname.value == "")
  {
    alert("Please enter a value for the \"firstname\" field.");
    theForm.firstname.focus();
    return (false);
  }
  	if (theForm.lastname.value == "")
  {
    alert("Please enter a value for the \"lastname\" field.");
    theForm.firstname.focus();
    return (false);
  }
if (theForm.username.value == "")
  {
    alert("Please enter a value for the \"username\" field.");
    theForm.firstname.focus();
    return (false);
  }
if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"email\" field.");
    theForm.email.focus();
    return (false);
  }	
  	if (theForm.password.value == "")
  {
    alert("Please enter a value for the \"password\" field.");
    theForm.email.focus();
    return (false);
  }
if (theForm.password.value != theForm.confirm.value)
{
	alert("The two passwords are not the same.");
	theForm.confirm.focus();
	return (false);
}
}

//--></script>
</head>

<BODY>
<p> </p>
<FORM METHOD="POST" ACTION="register.php" onsubmit="return Form1_Validator(this)" language="JavaScript" name="Form1">
  <div align="center">
  <table width="64%" border="1" cellspacing="0" cellpadding="3" style="border-width: 0px">
    <tr valign="middle"> 
      <td style="border-style: none; border-width: medium" colspan="2" bgcolor="#003366"> 
		<b>
		<font color="#FFFFFF" face="Verdana" size="2">
		Registration Process - Step 1 of 3:
		Create your Login </font></b>
    </tr>
    <tr valign="middle"> 
      <td colspan="2" bgcolor="#FFFFFF" height="44" style="border-style: none; border-width: medium"> 
		<font face="Verdana" style="font-size: 8pt">The following 
	information allows the system to set up and authenticate you as a 
	company.  No details should be given to anyone not authorised to 
	act on your companies behalf.  All information will be treated in 
	the strictest confidence as per our <b><font color="#0000FF">Privacy 
		Policy</font>.</b></font></td>
  </tr>
    <tr valign="middle"> 
      <td bgcolor="#003366" style="border-style: none; border-width: medium"> 
        <strong><font face="Tahoma" size="2" color="#FFFFFF">Type of 
	Registration</font></strong></td>
      <td style="border-style: none; border-width: medium" bgcolor="#003366"> 
		<b>
		<font color="#FFFFFF"><select size="1" name="regtype">
		<option selected>Company</option>
		<option>Affiliate</option>
		<option>Company & Affiliate</option>
		<option>Education Facility</option>
		<option>Government</option>
		<option>Other</option>
		</select></font></td>
    <tr>
      <td colspan="2" bgcolor="#FFFFFF" bordercolor="#FFFFFF" style="border-style: none; border-width: medium"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
	* Fields in <b> <font color="#990000">red</font></b> are required</font></td>
  	</tr>
    <tr valign="middle"> 
      <td bgcolor="#CCCCCC" style="border-style: none; border-width: medium"> 
        <font color="#990000" face="Tahoma"> 
		<b>
<strong><font size="2">First Name:</font></strong></font></td>
      <td style="border-style: none; border-width: medium"> 
		<b>
	<font color="#800000" face="Tahoma" size="1">
<INPUT NAME="firstname" SIZE=25 MAXLENGTH=50 style="font-weight: 700"></font></td>
    <tr valign="middle"> 
      <td bgcolor="#CCCCCC" style="border-style: none; border-width: medium"> 
        <font color="#990000" face="Tahoma"> 
		<b>
<strong><font size="2">Last Name:</font></strong></font></td>
      <td style="border-style: none; border-width: medium"> 
		<b>
	<font color="#800000" face="Tahoma" size="1">
<INPUT NAME="lastname" SIZE=25 MAXLENGTH=50 style="font-weight: 700"></font></td>
    <tr valign="middle"> 
      <td bgcolor="#CCCCCC" style="border-style: none; border-width: medium"> 
		<b>
	<font face="Tahoma" size="2" color="#990000">
Username:</font></td>
      <td style="border-style: none; border-width: medium"> 
		<b>
	<font color="#800000" face="Tahoma" size="1">
<INPUT NAME="username" SIZE=15 MAXLENGTH=50 style="font-weight: 700"></font></td>
    <tr valign="middle"> 
      <td bgcolor="#CCCCCC" style="border-style: none; border-width: medium"> 
        <b>
	<font face="Verdana, Arial, Helvetica, sans-serif" color="#990000" size="2">
	Password:</font></td>
      <td style="border-style: none; border-width: medium"> 
		<b>
	<font color="#800000" face="Tahoma" size="1">
<INPUT TYPE="password" NAME="password" SIZE=15 MAXLENGTH=25 style="font-weight: 700"></font></td>
    <tr valign="middle"> 
      <td bgcolor="#CCCCCC" style="border-style: none; border-width: medium"> 
		<b>
	<font size="2" color="#990000" face="Tahoma"><strong>Confirm Password:</strong></font></td>
      <td style="border-style: none; border-width: medium"> 
		<b>
	<font color="#800000" face="Tahoma" size="1">
<INPUT TYPE="password" NAME="confirm" SIZE=15 MAXLENGTH=25 style="font-weight: 700"></font></td>
    <tr valign="middle"> 
      <td bgcolor="#CCCCCC" style="border-style: none; border-width: medium"> 
		<b>
	<font color="#990000"><strong>
<font face="Tahoma" size="2">E-Mail Address</font></strong></font><font color="#990000" face="Tahoma"><strong><font size="2">:</font></strong></font></td>
      <td style="border-style: none; border-width: medium"> 
		<b>
	<font color="#800000" face="Tahoma" size="1">
<INPUT NAME="email" SIZE=29 MAXLENGTH=100 style="font-weight: 700"></font></td>
<tr>
      <td width="22%" bgcolor="#CCCCCC" bordercolor="#FFFFFF" style="border-style: none; border-width: medium"><b>
	<font size="1" color="#990000"> </font></b></td>
      <td width="77%" bgcolor="#FFFFFF" bordercolor="#FFFFFF" style="border-style: none; border-width: medium"><i><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
	 A confirmation email will be sent to the email address you specify.</font></i></td>
  	</tr>
<tr>
      <td width="17%" bgcolor="#CCCCCC" bordercolor="#FFFFFF" style="border-style: none; border-width: medium"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
	Country</font></b></td>
      <td width="68%" bgcolor="#FFFFFF" bordercolor="#FFFFFF" style="border-style: none; border-width: medium">
	<b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
        <input type="text" name="country" size="20" maxlength="20">
        </font></b></td>
  	</tr>
<tr>
      <td width="17%" bgcolor="#CCCCCC" bordercolor="#FFFFFF" style="border-style: none; border-width: medium"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
	Zip Code</font></b></td>
      <td width="68%" bgcolor="#FFFFFF" bordercolor="#FFFFFF" style="border-style: none; border-width: medium">
	<b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
        <input type="text" name="zipcode" size="20" maxlength="20">
        </font></b></td>
  		</tr>
    <tr valign="middle"> 
      <td colspan="2" style="border-style: none; border-width: medium"> 
		<b>
<P style="margin-top: 0; margin-bottom: 0" align="center">
<font color="#800000">
<INPUT TYPE="submit" NAME="submit" VALUE="Submit" style="font-family: Tahoma; font-weight:700"><input type="reset" name="Reset" value="Reset" style="font-weight: 700"></font></p>
    </td>
    <tr valign="middle"> 
      <td colspan="2" bgcolor="#003366" style="border-style: none; border-width: medium"> 
        <div align="center"> </div>
    </td>
</BODY>
</HTML>

 

Register.php

<?

//prevents caching
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: post-check=0, pre-check=0",false);
session_cache_limiter();

session_start();

//require the config file
require ("config.php");
require ("functions.php");

//checks password length
if (password_check($min_pass, $max_pass, $_POST[password]) == "no")
{
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="refresh" content="0; url=javascript:history.go(-1)">
<title>Registration</title>
<script language="JavaScript">
<!--
function FP_popUpMsg(msg) {//v1.0
alert(msg);
}
// -->
</script>
</head>

<body onload="FP_popUpMsg('Your password must be between <? echo $min_pass; ?> & <? echo $max_pass; ?> characters.')">

</body>

</html>
<?
exit;
}

//make the connection to the database
$connection = @mysql_connect($server, $dbusername, $dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection)or die(mysql_error());

//make query to database
$sql ="SELECT * FROM $table_name WHERE username= '$_POST[username]'";
$result = @mysql_query($sql,$connection) or die(mysql_error());

//get the number of rows in the result set
$num = mysql_num_rows($result);

//checks it see if that username already exists
if ($num != 0){

echo "<P>Sorry, that username already exists.</P>";
echo "<P><a href=\"#\" onClick=\"history.go(-1)\">Try Another Username.</a></p>";
exit;

}else{
$sql = "INSERT INTO $table_name VALUES
('$_POST[regtype]','$_POST[firstname]', '$_POST[lastname]', '$_POST[username]', password('$_POST[password]'), 'Users', '', '', '$pchange', 
'$_POST[email]', '$default_url', '$verify', '')";

$result = @mysql_query($sql,$connection) or die(mysql_error());
}

//checks to see if the user needs to verify their email address before accessing the site
if ($verify == "0")
{
$mailheaders = "From: www$domain\n";
$mailheaders .= "Your account has been created.\n";
$mailheaders .= "Please activate your account now by clicking on the link below and following the prompts:\n";
$mailheaders .= "$base_dir/activate.html\n";


$to = "$_POST[email]";
$subject = "Please activate your account";

mail($to, $subject, $mailheaders, "From: CareerPosition.org Administration <$adminemail>\n");

}else{
header('Location:login.html');
}



?>

<html>
<head>
<title>Email Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body text="#000000">

<p> </p>
<form name="vSignup" method="POST" action="process.php">
  <div align="center">
  <table width="64%" border="1" cellspacing="0" cellpadding="2" style="border-width: 0px">
    <tr valign="middle"> 
      <td bgcolor="#003366" style="border-style: none; border-width: medium"> 
		<b>
		<font color="#FFFFFF" face="Verdana" size="2">
		Email Confirmation - Step 2 of 3 </font></b>
    </td>
  </tr>
    <tr valign="middle"> 
      <td style="border-style: none; border-width: medium">
        <p align="center"> </p>
	<p align="center"><font face="Verdana" style="font-size: 8pt">Thank you 
	for your registration.  An email has been sent to the nominated 
	email address for confirmation.</font></p>
<p align="center"><font face="Verdana" style="font-size: 8pt">If you have 
any queries please 
<a href="mailto:[email protected]?subject=Registration Query">
<span style="text-decoration: none">contact us</span></a></font></p>
	<p> </td>
  </tr>
    <tr valign="middle"> 
      <td bgcolor="#003366" style="border-style: none; border-width: medium">
         </td>
  </tr>
</table>
</div>
</form>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/53696-error-message-regtype-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.