473,800 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

submitted form just shows itself

I have a form i will use to register new people and when I click the
submit button, the form just shows itself. It is supposed to show a
message showing field errors if you leave fields blank etc. so
submitting the empty form should show error message in red , then show
form, but all it does is show form. I checked the variable to make
shore they ere ok and they are fine. i believe it is a logical error
with my if else.... I eved modularized everything by using functions
and the same results.

if any one sees the logical error, let me know. Here the code:
<?php

function showmessage() {
// Check to make sure they entered a valid email address.
if (eregi("^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$",
$HTTP_POST_VARS['emailfield'])) {
$d = TRUE;
} else {
$d = FALSE;
$message1[] = "The email address you entered is not valid.";
}
return;
}

function checkfields(){

$year = $HTTP_POST_VARS['yearfield'];
$month = $HTTP_POST_VARS['monthfield'];
$day = $HTTP_POST_VARS['dayfield'];
$dobfield = $year.$month.$d ay;
// Check the last name.
if (eregi ("^([[:alpha:]]|-|')+$", $HTTP_POST_VARS['usernamefield']))
{
$a = TRUE;
} else {
$a = FALSE;
$message1[] = "Please enter a correct username. I.e; EricDerouen
that consists only of letters.";
}

// Check the first name.
if (eregi ("^([[:alpha:]]|-|')+$",
$HTTP_POST_VARS['firstnamefield '])) {
$b = TRUE;
} else {
$b = FALSE;
$message1[] = "Please enter a First Name that consists only of
letters.";
}

// Check the last name.
if (eregi ("^([[:alpha:]]|-|')+$", $HTTP_POST_VARS['lastnamefield']))
{
$c = TRUE;
} else {
$c = FALSE;
$message1[] = "Please enter a Last Name that consists only of
letters.";
}

// Check to make sure they entered a valid email address.
if (eregi("^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$",
$HTTP_POST_VARS['emailfield'])) {
$d = TRUE;
} else {
$d = FALSE;
$message1[] = "The email address you entered is not valid.";
}

// Check the password field.
if ($HTTP_POST_VAR S['passwordfield'] <> "") {
$e = TRUE;
} else {
$e = FALSE;
$message1[] = "Please enter a password.";
}

// Check validate password.
if ($HTTP_POST_VAR S['confirmfield'] =
$HTTP_POST_VARS['$passwordfield ']) {
$f = TRUE;
} else {
$f = FALSE;
$message1[] = "The password you entered do not match the password
you confirmed.";
}

// Check the City.
if (eregi ("^([[:alpha:]]|-|')+$", $HTTP_POST_VARS['cityfield'])) {
$g = TRUE;
} else {
$g = FALSE;
$message1[] = "Please enter a City that consists only of letters.";
}

// Check the state.
if (eregi ("^([[:alpha:]]|-|')+$", $HTTP_POST_VARS['statefield'])) {
$h = TRUE;
} else {
$h = FALSE;
$message1[] = "Please enter a State that consists only of letters.";
}

if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})",$dobfield ))
{
$i = TRUE;
} else {
$i = FALSE;
$message1[] = "The BIRTHDATE you entered is invalid.";
}
}

function connectandinser t(){

$hostname = "localhost" ;
$database = ""; //intentionally left out!
$username = "";
$password = "";

$connection = mysql_connect($ hostname, $username, $password) or
die(mysql_error ());
$db = mysql_select_db ($database, $connection) or die ("could not
connect to database");

//Time to insert variables from form into main table.
$query = "insert into main
(userneme,last, first,dob,atten ding,email,addr ess,city,state, phone,
cellphone,atten dedlast,passwor d) values
('$usernamefiel d','$lastnamefi eld','$firstnam efield','$dobfi eld','$radiobut ton2',
'$emailfield',' $addressfield', '$cityfield','$ statefield','$p honefield','$ce llphone','$radi obutton3','$pas swordfield')";

$result = mysql_query($qu ery)
or die ("could not execute query.");

}

function sendemails(){
//send email to customer using email he submitted.
$message1 = "{$firstnamefie ld},\n \nThank you for registering For the
Derouen Family Reunion.\n
You have been pre-registered to attend. A committee member will be
contacting you. \n
You will be also receive the latest Reunion via the E-Mail address
provided.\n
And don't forget to check our family reunion web-site from time to
time.\n \nReunion Committee\n Databaseindays. com";
if (mail($emailfie ld,"Re: Your Derouen Family Reunion",$messa ge1))
{echo "+";}
else {echo "-";}

//now why not send one to ourself with all the information.
$message1 = "First name: $firstnamefield \nLast Name:
$lastnamefield\ nEmail: $emailfield\nPh one: $phonefield\n
cellphone: $cellphone\nDOB : $dobfield\n$Add ress: $addressfield\n City:
$cityfield\nSta te: $statefield\nZi p: $zipfield\n
Attending: $radiobutton2\n Attended Last: $radiobutton3\n ";
if (mail("in**@dat abaseindays.com ","New Registration Form for Derouen
Family Reunion",$messa ge1))
{echo "+";}
else {echo " -";}
}
//*************** *************** *************** *************** *************** *******
if (!isset($_POST['submitbut']))
{
include("showre g_form.html");
exit;
}

checkfields();
if ($a AND $b AND $c AND $d AND $e AND $f AND $g AND $h AND $i)
{
connectandinser t();
sendemails();
echo "all went well. inserted and emailed your ass";
}
else
{
showmessage();
include("showre g_form.html");
}}

?>
Jul 17 '05 #1
10 2787
I noticed that Message-ID:
<1b************ **************@ posting.google. com> from Norman Bird
contained the following:
I have a form i will use to register new people and when I click the
submit button, the form just shows itself. It is supposed to show a
message showing field errors if you leave fields blank etc.


I'm no expert but I can't see a print or echo for the field errors.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
It would appears that you have pointed out a material error. When I
modularized the code, I put the email check code in the showmessage
area. this is wrong. Thank you. I will fix and keep everyone posted. I
looked over this code for day and i did not see this. Goes to show
you, sometimes you just need a new pair of eyes to look at the code.
At one point I had it right, but as I tried to fix another area , this
crept in. Thanks a lot buddy!


in**@databasein days.com (Norman Bird) wrote in message news:<1b******* *************** ****@posting.go ogle.com>...
I have a form i will use to register new people and when I click the
submit button, the form just shows itself. It is supposed to show a
message showing field errors if you leave fields blank etc. so
submitting the empty form should show error message in red , then show
form, but all it does is show form. I checked the variable to make
shore they ere ok and they are fine. i believe it is a logical error
with my if else.... I eved modularized everything by using functions
and the same results.

if any one sees the logical error, let me know. Here the code:
<?php

function showmessage() {
// Check to make sure they entered a valid email address.
if (eregi("^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$",
$HTTP_POST_VARS['emailfield'])) {
$d = TRUE;
} else {
$d = FALSE;
$message1[] = "The email address you entered is not valid.";
}
return;
}

function checkfields(){

$year = $HTTP_POST_VARS['yearfield'];
$month = $HTTP_POST_VARS['monthfield'];
$day = $HTTP_POST_VARS['dayfield'];
$dobfield = $year.$month.$d ay;
// Check the last name.
if (eregi ("^([[:alpha:]]|-|')+$", $HTTP_POST_VARS['usernamefield']))
{
$a = TRUE;
} else {
$a = FALSE;
$message1[] = "Please enter a correct username. I.e; EricDerouen
that consists only of letters.";
}

// Check the first name.
if (eregi ("^([[:alpha:]]|-|')+$",
$HTTP_POST_VARS['firstnamefield '])) {
$b = TRUE;
} else {
$b = FALSE;
$message1[] = "Please enter a First Name that consists only of
letters.";
}

// Check the last name.
if (eregi ("^([[:alpha:]]|-|')+$", $HTTP_POST_VARS['lastnamefield']))
{
$c = TRUE;
} else {
$c = FALSE;
$message1[] = "Please enter a Last Name that consists only of
letters.";
}

// Check to make sure they entered a valid email address.
if (eregi("^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$",
$HTTP_POST_VARS['emailfield'])) {
$d = TRUE;
} else {
$d = FALSE;
$message1[] = "The email address you entered is not valid.";
}

// Check the password field.
if ($HTTP_POST_VAR S['passwordfield'] <> "") {
$e = TRUE;
} else {
$e = FALSE;
$message1[] = "Please enter a password.";
}

// Check validate password.
if ($HTTP_POST_VAR S['confirmfield'] =
$HTTP_POST_VARS['$passwordfield ']) {
$f = TRUE;
} else {
$f = FALSE;
$message1[] = "The password you entered do not match the password
you confirmed.";
}

// Check the City.
if (eregi ("^([[:alpha:]]|-|')+$", $HTTP_POST_VARS['cityfield'])) {
$g = TRUE;
} else {
$g = FALSE;
$message1[] = "Please enter a City that consists only of letters.";
}

// Check the state.
if (eregi ("^([[:alpha:]]|-|')+$", $HTTP_POST_VARS['statefield'])) {
$h = TRUE;
} else {
$h = FALSE;
$message1[] = "Please enter a State that consists only of letters.";
}

if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})",$dobfield ))
{
$i = TRUE;
} else {
$i = FALSE;
$message1[] = "The BIRTHDATE you entered is invalid.";
}
}

function connectandinser t(){

$hostname = "localhost" ;
$database = ""; //intentionally left out!
$username = "";
$password = "";

$connection = mysql_connect($ hostname, $username, $password) or
die(mysql_error ());
$db = mysql_select_db ($database, $connection) or die ("could not
connect to database");

//Time to insert variables from form into main table.
$query = "insert into main
(userneme,last, first,dob,atten ding,email,addr ess,city,state, phone,
cellphone,atten dedlast,passwor d) values
('$usernamefiel d','$lastnamefi eld','$firstnam efield','$dobfi eld','$radiobut ton2',
'$emailfield',' $addressfield', '$cityfield','$ statefield','$p honefield','$ce llphone','$radi obutton3','$pas swordfield')";

$result = mysql_query($qu ery)
or die ("could not execute query.");

}

function sendemails(){
//send email to customer using email he submitted.
$message1 = "{$firstnamefie ld},\n \nThank you for registering For the
Derouen Family Reunion.\n
You have been pre-registered to attend. A committee member will be
contacting you. \n
You will be also receive the latest Reunion via the E-Mail address
provided.\n
And don't forget to check our family reunion web-site from time to
time.\n \nReunion Committee\n Databaseindays. com";
if (mail($emailfie ld,"Re: Your Derouen Family Reunion",$messa ge1))
{echo "+";}
else {echo "-";}

//now why not send one to ourself with all the information.
$message1 = "First name: $firstnamefield \nLast Name:
$lastnamefield\ nEmail: $emailfield\nPh one: $phonefield\n
cellphone: $cellphone\nDOB : $dobfield\n$Add ress: $addressfield\n City:
$cityfield\nSta te: $statefield\nZi p: $zipfield\n
Attending: $radiobutton2\n Attended Last: $radiobutton3\n ";
if (mail("in**@dat abaseindays.com ","New Registration Form for Derouen
Family Reunion",$messa ge1))
{echo "+";}
else {echo " -";}
}
//*************** *************** *************** *************** *************** *******
if (!isset($_POST['submitbut']))
{
include("showre g_form.html");
exit;
}

checkfields();
if ($a AND $b AND $c AND $d AND $e AND $f AND $g AND $h AND $i)
{
connectandinser t();
sendemails();
echo "all went well. inserted and emailed your ass";
}
else
{
showmessage();
include("showre g_form.html");
}}

?>

Jul 17 '05 #3
in**@databasein days.com (Norman Bird) wrote in message news:<1b******* *************** ****@posting.go ogle.com>...
It would appears that you have pointed out a material error. When I
modularized the code, I put the email check code in the showmessage
area. this is wrong. Thank you. I will fix and keep everyone posted. I
looked over this code for day and i did not see this. Goes to show
you, sometimes you just need a new pair of eyes to look at the code.
At one point I had it right, but as I tried to fix another area , this
crept in. Thanks a lot buddy!


I fixed that mistake below is the new code that still doesnot work.
anymore eyes see the problem why the errors dont show befor the form
is displayed?

<?php
//*************** *************** *************** *************** *************** *******

function connectdb(){
$hostname = "localhost" ;
$database = "";
$username = "";
$password = "";

$connection = mysql_connect($ hostname, $username, $password) or
die(mysql_error ());
$db = mysql_select_db ($database, $connection) or die ("could not
connect to database");

}

if (isset ($submitbut) ){
$year = $_POST['yearfield'];
$month = $_POST['monthfield'];
$day = $_POST['dayfield'];
$dobfield = $year.$month.$d ay;
// Check the last name.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['usernamefield'])) {
$a = TRUE;
} else {
$a = FALSE;
$message1[] = "Please enter a correct username. I.e; EricDerouen
that consists only of letters.";

}

// Check the first name.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['firstnamefield '])) {
$b = TRUE;
} else {
$b = FALSE;
$message1[] = "Please enter a First Name that consists only of
letters.";

}

// Check the last name.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['lastnamefield'])) {
$c = TRUE;
} else {
$c = FALSE;
$message1[] = "Please enter a Last Name that consists only of
letters.";
}

// Check to make sure they entered a valid email address.
if (eregi("^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$",
$_POST['emailfield'])) {
$d = TRUE;
} else {
$d = FALSE;
$message1[] = "The email address you entered is not valid.";
}

// Check the password field.
if ($_POST['passwordfield'] <> "") {
$e = TRUE;
} else {
$e = FALSE;
$message1[] = "Please enter a password.";
}

// Check validate password.
if ($_POST['confirmfield'] = $_POST['$passwordfield ']) {
$f = TRUE;
} else {
$f = FALSE;
$message1[] = "The password you entered do not match the password
you confirmed.";
}

// Check the City.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['cityfield'])) {
$g = TRUE;
} else {
$g = FALSE;
$message1[] = "Please enter a City that consists only of letters.";
}

// Check the state.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['statefield'])) {
$h = TRUE;
} else {
$h = FALSE;
$message1[] = "Please enter a State that consists only of letters.";
}

if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})",$dobfield ))
{
$i = TRUE;
} else {
$i = FALSE;
$message1[] = "The BIRTHDATE you entered is invalid.";
}

if ($a and $b and $c and $d and $e and $f and $g and $h and $i)
{
connectdb();

//Time to insert variables from form into main table.
$query = "insert into main
(userneme,last, first,dob,atten ding,email,addr ess,city,state, phone,
cellphone,atten dedlast,passwor d) values
('$usernamefiel d','$lastnamefi eld','$firstnam efield','$dobfi eld','$radiobut ton2',
'$emailfield',' $addressfield', '$cityfield','$ statefield','$p honefield','$ce llphone','$radi obutton3','$pas swordfield')";

$result = mysql_query($qu ery)
or die ("could not execute query.");

$message = "{$firstnamefie ld},\n \nThank you for registering For the
Derouen Family Reunion.\n
You have been pre-registered to attend. A committee member will be
contacting you. \n
You will be also receive the latest Reunion via the E-Mail address
provided.\n
And don't forget to check our family reunion web-site from time to
time.\n \nReunion Committee\n Databaseindays. com";
if (mail($emailfie ld,"Re: Your Derouen Family Reunion",$messa ge1))
{echo "+";}
else {echo "-";}

//now why not send one to ourself with all the information.
$message = "First name: $firstnamefield \nLast Name:
$lastnamefield\ nEmail: $emailfield\nPh one: $phonefield\n
cellphone: $cellphone\nDOB : $dobfield\n$Add ress: $addressfield\n City:
$cityfield\nSta te: $statefield\nZi p: $zipfield\n
Attending: $radiobutton2\n Attended Last: $radiobutton3\n ";
if (mail("in**@dat abaseindays.com ","New Registration Form for Derouen
Family Reunion",$messa ge1))
{echo "+";}
else {echo " -";}

echo "all went well. inserted and emailed your ass";

if ($message1) {
echo "<div align=\"center\ "><font color=red><b>Th e following problems
occurred:</b><br />\n";
foreach ($message1 as $key => $value) {
echo "$value <br />\n";
}
include("showre g_form.html");
}
}}
else
{

include("showre g_form.html");

} ?>
Jul 17 '05 #4
I noticed that Message-ID:
<1b************ **************@ posting.google. com> from Norman Bird
contained the following:
I fixed that mistake below is the new code that still doesnot work.
anymore eyes see the problem why the errors dont show befor the form
is displayed?


Don't you have to get the function to return the variable?
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #5
I noticed that Message-ID: <70************ *************** *****@4ax.com>
from Geoff Berrow contained the following:
I fixed that mistake below is the new code that still doesnot work.
anymore eyes see the problem why the errors dont show befor the form
is displayed?


Don't you have to get the function to return the variable?


Ignore that - I noticed you got rid of the functions

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #6
Norman Bird wrote:
I fixed that mistake below is the new code that still doesnot work.
anymore eyes see the problem why the errors dont show befor the form
is displayed?
if (isset ($submitbut) ){
$year = $_POST['yearfield'];
$month = $_POST['monthfield'];
$day = $_POST['dayfield'];


I think the submit button is named submitbut, right? So if you want to
use the varaible $submitbut you should read it with

$submitbut = $_POST['submitbut'];

before as you do it with the other variables.
Frank

--
http://www.pncommerce.de

Jul 17 '05 #7
Frank Schummertz <fr************ **@landseer-stuttgart.de> wrote in message news:<br******* ***@ulysses.new s.tiscali.de>.. .
Norman Bird wrote:
I fixed that mistake below is the new code that still doesnot work.
anymore eyes see the problem why the errors dont show befor the form
is displayed?

if (isset ($submitbut) ){
$year = $_POST['yearfield'];
$month = $_POST['monthfield'];
$day = $_POST['dayfield'];


I think the submit button is named submitbut, right? So if you want to
use the varaible $submitbut you should read it with

$submitbut = $_POST['submitbut'];

before as you do it with the other variables.
Frank


I actually don't think so. once the form is submitted , the variable
is available. I also used the popular method of :

if (isset($_post['submitbut']))
and that did not work either. I think its the way I do the if..else...
Jul 17 '05 #8
On Mon, 15 Dec 2003 06:48:40 -0800, Norman Bird wrote:
I actually don't think so. once the form is submitted , the variable is
available. I also used the popular method of :

if (isset($_post['submitbut']))
and that did not work either. I think its the way I do the if..else...

Norman,

Stupid question maybe, but I couldn't see any form code available here...
you have got the submit button name defined haven't you?:
<input type="submit" name="submitbut " value="Submit" />
for example?

Just a thought =)

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
Programming, Web design, development & hosting.

Jul 17 '05 #9
I finally got the registration form to work. Code is below. It is
actually a good example to use to register people. I believe my
problem was the fact that I showed the form using an
"include(showfo rm.php)". Since I had the form calling itself if there
was a problem, this caused a problem showing the errors. Once I
included the code to show form all in the same script, this made
everything fire like it was supposed to. This script displays a form
and checks the fields for valid info then inserts into a DB then
amails the user his registration info then emails you a new person
registered than thanks the user. thanks to all tha helped:

<?php
//*************** *************** *************** *************** *************** *******
function thankyou(){
?>
<html>
<body bgcolor="#FFFFF F">
<div align="center"> <font color="#669933" size="6" face="Comic Sans
MS">Thank
you </font> </div>
<p align="center"> <font color="#669933" size="4" face="Comic Sans
MS">for registering
for the website.<br>
You will soon receive an email confirmation of your
registration.<b r>
You can login to the site now using the username and password you
provided.<br>
A committee member will also be contacting you.
</font></p>
<h3 align="center"> &nbsp;</h3>
<h3 align="center"> Email us at: <a
href="mailto:in **@xxx.com">in* *@xxx.Com</a></h3>
<p align="center"> <font size="4"> | <a href="login.php ">Login
</a>&nbsp; | <a href="index.htm l">Home</a> |</font></p>
</body>
</html>
<?php

}
function connectdb(){
$hostname = "localhost" ;
$database = "xxx";
$username = "xxx";
$password = "xxx";

$connection = mysql_connect($ hostname, $username, $password) or
die(mysql_error ());
$db = mysql_select_db ($database, $connection) or die ("could not
connect to database");

}

function showform(){
?>
<html>
<head>
<title>Regist er to the Derouen Family Web-Site</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body bgcolor="#FFFFF F" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0 ">
<form name="form2" method="post" action= "register.p hp" >
<table width="90%" border="0" cellpadding="8" bgcolor="#FFFFF F">
<tr>
<td colspan="3" bgcolor="#CCCCC C">
<b>Register for the xxx </b></td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C" nowrap>
User Name<font size="-2">*</font></td>
<td colspan="2" bgcolor="#FFFFF F"> <input
name="usernamef ield" type="text" id="usernamefie ld" size="25"
maxlength="25" value="<?php echo $usernamefield ?>">
<br>
<font size="-2">*</font>Enter a user name.
Ex.&nbsp;&nbsp; &nbsp;&nbsp; xxx <font size="-1">&nbsp; </font></td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C">
Password<font size="-2">*</font></td>
<td colspan="2" bgcolor="#FFFFF F"> <input
name="passwordf ield" type="password" id="passwordfie ld" size="25"
maxlength="25"> </td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C">
Confirm<br>
Password</td>
<td colspan="2" bgcolor="#FFFFF F"> <input
name="confirmfi eld" type="password" id="confirmfiel d" size="25"
maxlength="25">
<br>
<font size="-2">*</font><font size="-1">Confirm the password
you entered </font></td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C">
Name</td>
<td width="43%" bgcolor="#FFFFF F"> <input
name="firstname field" type="text" id="firstnamefi eld" size="25"
maxlength="25" value="<?php echo $firstnamefield ?>">
<br> <font size="-1">First</font></td>
<td width="46%" bgcolor="#FFFFF F"> <input
name="lastnamef ield" type="text" id="lastnamefie ld" size="25"
maxlength="25" value="<?php echo $lastnamefield ?>">
<br> <font size="-1">Last</font></td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C">
Email</td>
<td colspan="2" bgcolor="#FFFFF F"> <input
name="emailfiel d" type="text" id="emailfield " size="50" maxlength="50"
value="<?php echo $emailfield ?>">
Ex. JS****@Comcast. net </td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C">
Phone</td>
<td colspan="2" bgcolor="#FFFFF F"><input name="phonefiel d"
type="text" id="phonefield " size="15" maxlength="15" value="<?php echo
$phonefield ?>">
&nbsp;&nbsp;Cel l Phone
<input name="cellphone field" type="text" id="cellphonefi eld"
size="15" maxlength="15" value="<?php echo $cellphonefield ?>">
</td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C">
Address</td>
<td colspan="2" bgcolor="#FFFFF F"> <input
name="addressfi eld" type="text" id="addressfiel d" size="50"
maxlength="50" value="<?php echo $addressfield ?>">
</td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C">
City/State/Zip</td>
<td colspan="2" bgcolor="#FFFFF F"> <input
name="cityfield " type="text" id="cityfield" size="25" maxlength="25"
value="<?php echo $cityfield ?>">
&nbsp; State:
<input name="statefiel d" type="text" id="statefield " size="2"
maxlength="2" value="<?php echo $statefield ?>">
&nbsp; Zip:
<input name="zipcodefi eld" type="text" id="zipcodefiel d"
size="10" maxlength="10" value="<?php echo $zipcodefield ?>">
</td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C">
Gender</td>
<td colspan="2" bgcolor="#FFFFF F"> <p>
<input type="radio" name="radiobutt on1" value="male">
Male
<input type="radio" name="radiobutt on1" value="female">
Female </p></td>
</tr>
<tr valign="top">
<td align="right" bgcolor="#CCCCC C">
Birth Date</td>
<td colspan="2" bgcolor="#FFFFF F"> <table border="0"
cellspacing="2" cellpadding="0" >
<tr align="left">
<td><input name="monthfiel d" type="text"
id="monthfield " size="2" maxlength="2"></td>
<td><input name="dayfield" type="text" id="dayfield"
size="2" maxlength="2"></td>
<td><input name="yearfield " type="text" id="yearfield"
size="4" maxlength="4"></td>
</tr>
<tr align="left">
<td>MM</td>
<td>DD</td>
<td>YYYY</td>
</tr>
</table></td>
</tr>
<tr valign="top">
<td colspan="3"> <p>Do you plan on attending the next
?.<br>
<input type="radio" name="radiobutt on2" value="yes">
Yes<br>
<input type="radio" name="radiobutt on2" value="no">
No</p>
<p>Did you attend the last Reunion?. <br>
<input type="radio" name="radiobutt on3" value="yes">
Yes<br>
<input type="radio" name="radiobutt on3" value="no">
No</p></td>
</tr>
<tr valign="top" bgcolor="#FFFFF F">
<td colspan="3"><in put type="submit" name="submitbut "
value="Submit Registration Information"></td>
</tr>
</table>
</form>
</body>
</html>
<?php
}
if (isset ($_POST['submitbut'])){
//echo "but is set";
$year = $_POST['yearfield'];
$month = $_POST['monthfield'];
$day = $_POST['dayfield'];
$dobfield = $year.'-'.$month.'-'.$day;
//echo "this is the date : $dobfield";
//exit;
// Check the last name.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['usernamefield'])) {
$a = TRUE;
} else {
$a = FALSE;
$message1[] = "Please enter a correct username. I.e; EricDerouen
that consists only of letters.";

}

// Check the first name.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['firstnamefield '])) {
$b = TRUE;
} else {
$b = FALSE;
$message1[] = "Please enter a First Name that consists only of
letters.";

}

// Check the last name.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['lastnamefield'])) {
$c = TRUE;
} else {
$c = FALSE;
$message1[] = "Please enter a Last Name that consists only of
letters.";
}

// Check to make sure they entered a valid email address.
if (eregi("^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$",
$_POST['emailfield'])) {
$d = TRUE;
} else {
$d = FALSE;
$message1[] = "The email address you entered is not valid.";
}

// Check the password field.
if ($_POST['passwordfield'] <> "") {
$e = TRUE;
} else {
$e = FALSE;
$message1[] = "Please enter a password.";
}

// Check validate password.
if ($_POST[confirmfield] = $_POST['passwordfield']) {
$f = TRUE;
} else {
$f = FALSE;
$message1[] = "The password you entered do not match the password
you confirmed.";
}

// Check the City.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['cityfield'])) {
$g = TRUE;
} else {
$g = FALSE;
$message1[] = "Please enter a City that consists only of letters.";
}

// Check the state.
if (eregi ("^([[:alpha:]]|-|')+$", $_POST['statefield'])) {
$h = TRUE;
} else {
$h = FALSE;
$message1[] = "Please enter a State that consists only of letters.";
}

if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})",$dobfield ))
{
$i = TRUE;
} else {
$i = FALSE;
$message1[] = "The BIRTHDATE you entered is invalid.";
}}

if ($a and $b and $c and $d and $e and $f and $g and $h and $i)
{

connectdb();

//Time to insert variables from form into main table.
$query = "insert into main
(username,last, first,dob,atten ding,email,addr ess,city,state, zip,phone,
cellphone,atten dedlast,passwor d) values
('$usernamefiel d','$lastnamefi eld','$firstnam efield','$dobfi eld','$radiobut ton2',
'$emailfield',' $addressfield', '$cityfield','$ statefield','$z ipcodefield','$ phonefield','$c ellphone','$rad iobutton3','$pa sswordfield')";

$result = mysql_query($qu ery)
or die ("could not execute query.");

$message = "{$firstnamefie ld},\n \nThank you for registering For the
Reunion.\n
You have been pre-registered to attend. A committee member will be
contacting you. \n
You will also receive the latest Reunion information via the E-Mail
address provided.\n
And don't forget to check our family reunion web-site from time to
time.\n
Your userid is: $username\nYour password is $passwordfield\ n
\nReunion 2004 Committee.\n <a href="www.xxx.c om/login.php">Logi n
Here</a>";
if (mail($emailfie ld,"Re: Your Reunion",$messa ge))
{echo "+";}
else {echo "-";}

//now why not send one to ourself with all the information.
$message = "Username: $usernamefield\ nFirst name:
$firstnamefield \nLast Name: $lastnamefield\ nEmail: $emailfield\nPh one:
$phonefield
cellphone: $cellphonefield \nDOB: $dobfield\nAddr ess:
$addressfield\n City: $cityfield\nSta te: $statefield\nZi p:
$zipcodefield
Attending: $radiobutton2\n Attended Last: $radiobutton3\n
Username: $usernamefield" ;
if (mail("in**@xxx .com","New Registration Form for Reunion",$messa ge))
{echo "+";}
else {echo " -";}

thankyou();
}
else
{
//echo "some fields are wrong";
if ($message1) {
echo "<div align=center><f ont color=red><b>Th e following problems
occurred:</b><br />\n";
foreach ($message1 as $key => $value) {
echo "$value <br />\n";
}

}
showform();
} ?>
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5294
by: kaeli | last post by:
Hey all, This is a nitpick that I'd like to fix if possible... I have a form that submits to a page that does some intense DB queries, so the page takes about 30-45 seconds to load. Using Win2K, IE6, when the submit button is clicked, it looks like nothing is happening (unless you read the status bar and see the page opening text). Yet Netscape shows a little hourglass, indicating that processing is occurring. Is there a simple way to...
0
1533
by: Rene | last post by:
I developed a "themed" application that relies heavily on background pictures for just about every control that the application uses, if the control does not have a background picture it is usually set to be transparent so that the parent picture shows through. To make matters even worst, the application is intended to run on a very slow computer 400 to 500 megahertz. The only problem that I have is that when the user moves from form...
4
6076
by: Paradox | last post by:
Hey, I'm trying to figure out what situations call for the use of a derived form control such as: public class myListBox : System.Windows.Forms.ListBox and what situations call for the use of a Custom User Control, generated by adding a new Custom User Control to a project with VS.NET.
5
1162
by: Eric Shin | last post by:
Hi all. I'm like really on the beginning stage for ASP.NET just got a few questions to ask... Please help me. I've created a form page called "join.aspx" and it has lots of codes but the important part needed to be focused on is the following lines. <asp:textbox id="firstname" runat="server" />
9
4670
by: Kevin Blount | last post by:
Here's the code I tried, and found it failed... <form runat="server" method="post" name="CreditCardForm" id="CreditCardForm"> <% foreach (object item in Request.Form) { if (item.ToString().IndexOf("__") != 0) { //Response.Write(item + " = " + Request.Form +
0
1236
by: Miro | last post by:
Something I have run into using VB Express 2005 with mdi forms. I have not been able to re-create this but I'll let out the information on how I came about fixing this. As it cost me about 4 hours last night so it might be a good read for anyone who uses mdi's. 1. I have Parent form that is an MDI conatainer. On the top of the form I have a panel docked, and on the left hand side of the form I have a panel docked with a splitter....
8
7558
by: Mitch5713 | last post by:
I've got tthree forms at start up splashscreen- works fine however how do i set the time delay so it stays on the window longer,, shows longer?? Loginscreen- works fine, after the data processing of username etc is done I then need to load, call whatever the syntax is the mainForm at the end of the loginscreen..????? how is that done so it starts at the mainForm_Load procedure??? As it stands now the mainform loads but just for a split...
4
13421
by: Leah Trahan | last post by:
I am new at Access, databases, AND posting threads (sorry). I have a subform that is a continuous form based on a tabular query. I enter a particular serial # (on the main form) and the subform shows me one to several forms that are related to that serial #. Each form shows only a few select fields of that particular record. I would like to be able to click a Veiw button (which is a cmd button on this subform) to bring up yet another form...
10
7072
by: menashay | last post by:
Hello, I am absolute beginner in C# so pardon me if the following question is too easy. I have a form with a one button. When I click the button I want to display a message that reads "Button was clicked" However, I do not want to handle the click event from that form, instead I want to "transfer" that event to a "controller" class that shows that message.
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10251
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.