i'm trying to get some forms working, and even though they work better after the answers to my last post, there's still a number of issues. if anyone is willing to take the time and help me by looking at the test code i made for a smaller set that wont interact with databases, i would greatly appreciate help in finding out why it's not working.
please contact me on aol instant messenger: paradoxalive
-Josh
help please
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
alright. although i instead tried convert it over to something more like the final one, although i realized i have to split it into two files. one to start the sign up and one to go through the process. (so that the post method can be used)twigletmac wrote:Why not post the code here?
Mac
the javascript to check is NOT working and i'm not entirely sure why (but looking into it)
start page
Code: Select all
<?php
// this is unfinished!!!!!!
/* create session information */
$uid=uniqid(microtime(),1); // make a unique id
session_start(); // start a session
$SESSION['uid']=$uid; // set the uid for the session and validation code
echo "<html><head><title>FindYourDesire Sign up step 1</title></head>\n";
echo "<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4"><center>\n";
echo "\n\n<h1>THIS IS A TEST. IT DOES NOT HAVE A DATABASE CONNECTION NOR DOES IT CHECK USERNAMES. THIS LINE WILL BE REMOVED IN THE REAL ONE </h1>\n\n";
echo "<p>Thank you for your interest in signing up for FindYourDesire.com. before you can sign up, you need to agree to a few baisc terms of service</p>\n";
echo "<form name="step1" action="signup.php" method="POST" onsubmit="validate()">\n";
echo "<input type="hidden" name="uid" value="$uid"><input type="hidden" name="step" value="2">";
echo "<table frame="void" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">\n";
echo "<tr><td>I have read and agree to the <a name="#privacy" href="#privacy" onClick="window.open('faq.php?seek=privacy', 'faq', 'height=250,width=500,scrollbars=yes');">Privacy Policy</a></td><td><input type="checkbox" name="privacy" value="agree"></td></tr>\n";
echo "<tr><td>I have read and agree to the <a name="#fcc" href="#fcc" onClick="window.open('faq.php?seek=fcc', 'faq', 'height=250,width=500,scrollbars=yes');">Forum Civilty Code</a></td><td><input type="checkbox" name="fcc" value="agree"></td></tr>\n";
echo "<tr><td>I have read and agree to the <a name="#gtu" href="#gtu" onClick="window.open('faq.php?seek=gtu', 'faq', 'height=250,width=500,scrollbars=yes');">General Terms of Use</a></td><td><input type="checkbox" name="gtu" value="agree"></td></tr>\n";
echo "<tr><td>I have read and agree to the <a name="#lw" href="lw" onClick="window.open('faq.php?seek=lw', 'faq', 'height=250,width=500,scrollbars=yes');">Liabilty Waiver</a></td><td><input type="checkbox" name="lw" value="agree"></td></tr>\n";
echo "<tr><td><input type="submit" value="Go To The Next Step"></td><td><input type="reset" value="Restart This Step"></td></tr>\n</table>\n\n";
echo "<script language="javascript">\n";
echo "function validate(){\n";
echo "var privacy=document.step1.privacy.value();\n";
echo "var fcc=document.step1.fcc.value();\n";
echo "var gtu=document.step1.gtu.value();\n";
echo "var lw=document.step1.lw.value();\n";
echo "if(privacy==null){alert("You MUST agree to the Privacy Policy to continue")};\n";
echo "elseif(fcc==null){alert("You MUST agree to the Forum Civility Code to continue")};\n";
echo "elseif(gtu==null){alert("You MUST agree to the General Terms of Use to continue")};\n";
echo "elseif(lw==null){alert("You MUST agree to the Liability Waiver to continue")};\n";
echo "else{return true};}\n";
echo "</script>\n";
echo "</center></body></html>";
// this is unfinished!!!!!!
?>Code: Select all
<?php
/* set the variables. should be null if they don't exist */
$step=$_POST['step']; $uid=$_POST['uid'];
/* end variables */
/* notes */
/* all the steps need to connect to the database. most variables unset. **
** need a way to send an e-mail witht he username, pass and validation code (uid) after step 2. **
** need a way to time out on names not validated. */
/* end notes */
if(isset($step)){
if($step==2){
/* add database connection here */
// this is unfinished!!!!!!
echo "<html><head><title>Find Your Desire Sign Up Step 2</title></head>\n";
echo "<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4"><center>\n";
echo "\n\n<h1>THIS IS A TEST. IT DOES NOT HAVE A DATABASE CONNECTION NOR DOES IT CHECK USERNAMES. THIS LINE WILL BE REMOVED IN THE REAL ONE </h1>\n\n";
echo "<p>Thank you for your interest in joining FindYourDesire.com. We need to know some things about you in order to make your profile here. Any feild in <font color="#ff6500">ORANGE</font> is required. Any feild marked with an * is confidential and will NOT show up in your user stats. Any feild with a ° will not show up in your usser stats, but is collected for the "Desired" member's dating services' search.</p>\n";
echo "<p><form name="step2" action="signup.php" method="POST" onsubmit="validate();">\n";
echo "<input type="hidden" name="uid" value="$uid"><input type="hidden" name="step" value="3">";
echo "<table frame="void" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0">\n";
echo "<tr><td colspan="2" align="center"><!-- inner table for required information -->\n";
echo "<table frame="void" bgcolor="#ff6500" border="1" cellpadding="0" cellspacing="0">\n";
echo "<tr><td>User Name</td><td><input type="text" maxlength="15" name="un" size="15"></td></tr>\n";
echo "<tr><td>Password*</td><td><input type="password" name="pw" size="15"></td><tr>\n";
echo "<tr><td>Password (incase of a typo)*</td><td><input type="password" name="pwc" size="15"></td></tr>\n";
echo "<tr><td>Email Address*</td><td><input type="text" name="email" size="30"></td></tr>\n";
echo "</table></td></tr><!-- end required -->\n";
echo "<tr><td><a name="#dob" href="#dob" onClick="window.open('faq.php?seek=dob', 'faq', 'width=500,height=250,scrollbars=yes');">Date Of Birth</a></td><td><select name="month" size="1"><option value="1">January</option><option value="2">February</option><option value="3">March</option><option value="4">April</option><option value="5">May</option><option value="6">June</option><option value="7">July</option><option value="8">August</option><option value="9">September</option><option value="10">October</option><option value="11">November</option><option value="12">December</option></select><select name="day" size="1">";
for($i=1;$i<32;$i++){echo "<option value="$i">$i</option>";}
echo "</select><select name="year" size="1">";
for($j=1900;$j<1995;$j++){echo "<option value="$j">$j</option>";}
echo "</select></td></tr>\n";
echo "<tr><td>Gender</td><td><select name="gender" size="1"><option selected value="female">Female</option><option value="male">male</option></td></tr>\n";
echo "<tr><td>Sexual Preference</td><td><select name="sexpref"><option selected value="dta">Decline to Answer</option><option value="straight">Straight</option><option value="bisexual">Bisexual</option><option value="homosexual">Homosex+ual</option><option value="trans">Transgender/Transsexual</option></select></td</tr>\n";
echo "<tr><td>Marital Status</td><td><select name="marstat" size="1"><option selected value="dta">Decline to Answer</option><option value="single">single</option><option value="gs">Going steady</option><option value="engaged">Engaged</option><option value="married">Married</option><option value="divorced">Divorced</option><option value="wid">Wiodow/Widower</option></select></td></tr>\n";
echo "<tr><td>Country of Origin</td><td><select name="country" size="1"><option value="USA">USA</option><option value="Canada">Canada</option><option value="Australia">Australia</option><option value="UK">UK</option><option value="Spain">Spain</option><option value="Other">Other</other></select></td></tr>\n";
echo "<tr><td>Height</td><td><select name="feet"><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option></select> feet <select name="inches">";
for($k=0;$k<12;$k++){echo "<option value="$k">$k</option>";}
echo "</select> inches</td></tr>\n";
echo "<tr><td>Waist</td><td><input type="text" maxlength="3" size="3" name="waist">inches</td></tr>\n";
echo "<tr><td>Eye Color</td><td><input type="text" name="eye" maxlength="10" size="10"</td></tr>\n";
echo "<tr><td>Hair Color</td><td><select size="1" name="hair"><option value="Black">Black</option><option value="Brown">Brown</option><option value="Red">Red</option><option value="Blonde">Blonde</option><option value="dyed">Dyed</option></select></td></tr>\n";
echo "<tr><td>Weight</td><td><input type="text" max size="4" name="weight" size="4"></td></tr>\n";
echo "<tr><td>Body Type</td><td><select name="body" size="1"><option value="Thin">Thin</option><option value="Athletic-Not Musclebound">Athletic & not Musclebound</option><option value="Athletic-Musclebound">Athletic & Musclebound</option><option value="Heavyset">Heavyset</option><option value="Overweight">Overweight</option><option value="dta">Decline to Answer</option></select></td></tr>\n";
echo "<tr><td>Level of Education°</td><td><select name="education"><option value="hs">High School</option><option value="Associate">Associate's (2-yr)</option><option value="Bachelor">Bachelor's (4-yr)</option><option value="Master">Master's</option><option value="PHD">Doctorate</option></select></td></tr>\n";
echo "<tr><td>Employment Status°</td><td><select name="emp" size="1"><option value="Student">Student</option><option value="unemployed">unemployed</option><option value="pt">Part Time</option><option value="ft">Full Time</option><option value="self">Self Employed</option><option value="retired">Retired</option></select></td></tr>\n";
echo "<tr><td>Religion°</td><td><input type="text" size="20"></td></tr>\n";
echo "<tr><td>Ethnic Background°</td><td><input type="text"size="20"></td></tr>\n";
echo "<tr><td>City°</td><td><input type="text"size="25" maxlength="100" name="city"></td></tr>\n";
echo "<tr><td>State/Province/Territory°</td><td><select name="spt" size="1"><option value="Alabama">Alabama</option><option value="Alaska">Alaska</option><option value="Alberta">Alberta</option><option value="American Samoa">American Samoa</option><option value="Arizona">Arizona</option><option value="Arkansas">Arkansas</option><option value="British Columbia">British Columbia</option><option value="California">California</option><option value="Colorado">Colorado</option><option value="Connecticut">Connecticut</option><option value="Delaware">Delaware</option><option value="Federated States Of Micronesia">Federated States Of Micronesia</option><option value="Florida">Florida</option><option value="Georgia">Georgia</option><option value="Guam">Guam</option><option value="Hawaii">Hawaii</option><option value="Idaho">Idaho</option><option value="Illinois">Illinois</option><option value="Indiana">Indiana</option><option value="Iowa">Iowa</option><option value="Kansas">Kansas</option><option value="Kentucky">Kentucky</option><option value="Louisiana">Louisiana</option><option value="Maine">Maine</option><option value="Manitoba">Manitoba</option><option value="Marshall Islands">Marshall Islands</option><option value="Maryland">Maryland</option><option value="Massachusetts">Massachusetts</option><option value="Michigan">Michigan</option><option value="Minnesota">Minnesota</option><option value="Mississippi">Mississippi</option><option value="Missouri">Missouri</option><option value="Montana">Montana</option><option value="Nebraska">Nebraska</option><option value="Nevada">Nevada</option><option value="New Brunswick">New Brunswick</option><option value="New Hampshire">New Hampshire</option><option value="New Jersey">New Jersey</option><option value="New Mexico">New Mexico</option><option value="New York">New York</option><option value="Newfoundland">Newfoundland</option><option value="North Carolina">North Carolina</option><option value="North Dakota">North Dakota</option><option value="Northern Mariana Islands">Northern Mariana Islands</option><option value="Northwest Territories">Northwest Territories</option><option value="Nova Scotia">Nova Scotia</option><option value="Ohio">Ohio</option><option value="Oklahoma">Oklahoma</option><option value="Ontario">Ontario</option><option value="Oregon">Oregon</option><option value="Palau">Palau</option><option value="Pennsylvania">Pennsylvania</option><option value="Prince Edward Island">Prince Edward Island</option><option value="Puerto Rico">Puerto Rico</option><option value="Quebec">Quebec</option><option value="Rhode Island">Rhode Island</option><option value="Saskatchewan">Saskatchewan</option><option value="South Carolina">South Carolina</option><option value="South Dakota">South Dakota</option><option value="Tennessee">Tennessee</option><option value="Texas">Texas</option><option value="Utah">Utah</option><option value="Vermont">Vermont</option><option value="Virgin Islands">Virgin Islands</option><option value="Virginia">Virginia</option><option value="Washington">Washington</option><option value="Washington, District Of Columbia">Washington, District Of Columbia</option><option value="West Virginia">West Virginia</option><option value="Wisconsin">Wisconsin</option><option value="Wyoming">Wyoming</option><option value="Yukon">Yukon</option><option value="niuc">Other/Not Listed</option></select></td></tr>\n";
echo "<tr><td>Chinese Zodiac</td><td><select name="czodiac" size="1"><option value="Ram">Ram</option><option value="Dragon">Dragon</option><option value="Horse">Horse</option><option value="Ox">Ox</option><option value="Rat">Rat</option><option value="Tiger">Tiger</option><option value="Monkey">Monkey</option><option value="Snake">Snake</option><option value="Dog">Dog</option><option value="Rabbit">Rabbit</option><option value="Pig">Pig</option><option value="Rooster">Rooster</option><option value="dk">Don't Know</option></select></td></tr>\n";
echo "<tr><td>Zodiac</td><td><select value="rzodiac" size="1"><option value="Aquarius">Aquarius</option><option value="Pisces">Pisces</option><option value="Aries">Aries</option><option value"Taurus">Taurus</option><option value="Gemini">Gemini</option><option value="Cancer">Cancer</option><option value="Leo">Leo</option><option value="Virgo">Virgo</option><option value="Libra">Libra</option><option value="Scorpio">Scorpio</option><option value="Sagittarius">Sagittarius</option><option value="Capricorn">Capricorn</option><option value="dk">Don't Know</option></select></td></tr>\n";
echo "<tr><td>You Catagorize Yourself As...</td><td><select name="selfcat"><option value="dta">Decline to Answer</option><option value="Preppy">Preppy</option><option value="Jock">Jock</option><option value="Skater">Skater</option><option value="Hippy">Hippy</option><option value="Goth">Goth</option><option value="NG">Nerd/Geek</option></select></td></tr>\n";
echo "<tr><td><a href="http://www.aim.com" target="_blank">AOL Instant Messenger</a></td><td><input type="text" size="16" maxlength="16"></td></tr>\n";
echo "<tr><td><a href="http://web.icq.com/" target="_blank">ICQ</a></td><td><input type="text" size="16" maxlength="12"></td></tr>\n";
echo "<tr><td><a href="http://www.mirc.com/" target="_blank">mIRC</a></td><td><input type="text" size="16"></td></tr>\n";
echo "<tr><td><a href="http://messenger.yahoo.com" target="_blank">Y!</a></td><td><input type="text" size="16"></td></tr>\n";
echo "<tr><td><input type="submit" value="Go To The Next Step"></td>";
echo "<td><input type="reset" value="Restart This Step"></td></tr>\n";
echo "</table></p><p> </p><p> </p>\n";
echo "</center></body></html>";
echo "<script language="javascript">\n";
echo "function validate(){\n";
echo "var pw=document.step2.pw.value();\n";
echo "var pwc=document.test.pwc.value();\n";
echo "var email=document.test.email.value();\n";
echo "if(pw.length<3){alert("Your password is too short.")};\n";
echo "elseif(pw!=pwc){alert("Your passwords do not match.")};\n";
echo "elseif(!(email.match([\w\.-]+\@[\w\.-]+\w\w\w?))){alert("That does not seem to be a real e-mail address.")};\n";
echo "else{return true};\n";
echo "</script>\n";
// this is unfinished!!!!!!
}elseif($step==3){
/* add database connection here */
// this is unfinished!!!!!!
echo "<html><head><title>FindYourDesire sign up step 3</title></head>\n";
echo "<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4"><center>\n";
echo "\n\n<h1>THIS IS A TEST. IT DOES NOT HAVE A DATABASE CONNECTION NOR DOES IT CHECK USERNAMES. THIS LINE WILL BE REMOVED IN THE REAL ONE </h1>\n\n";
echo "<p>Thank you for your interest in joining FindYourDesire.com. We need to know some things about you in order to make your profile here. Any feild in <font color="#ff6500">ORANGE</font> is required. Any feild marked with an * is confidential and will NOT show up in your user stats. Any feild with a ° will not show up in your usser stats, but is collected for the "Desired" member's dating services' search.</p>\n";
echo "<p><form name="step3" action="signup.php" method="POST" onsubmit="validate();">\n";
echo "<input type="hidden" name="uid" value="$uid"><input type="hidden" name="step" value="4">";
echo "<table frame="void" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0">\n";
echo "<tr><td colspan="2">Bio Question #1<td></tr>\n";
echo "<tr><td colspan="2"><input type="text" name="bq1" maxsize="200" size="75"></td></tr>\n";
echo "<tr><td colspan="2">Bio Question #2<td></tr>\n";
echo "<tr><td colspan="2"><input type="text" name="bq2" maxsize="200" size="75"></td></tr>\n";
echo "<tr><td colspan="2">Bio Question #3<td></tr>\n";
echo "<tr><td colspan="2"><input type="text" name="bq3" maxsize="200" size="75"></td></tr>\n";
echo "<tr><td colspan="2">Bio Question #4<td></tr>\n";
echo "<tr><td colspan="2"><input type="text" name="bq4" maxsize="200" size="75"></td></tr>\n";
echo "<tr><td colspan="2">open bio (max size=2500 characters. anything above it will be lost)<td></tr>\n";
echo "<tr><td colspan="2"><textarea name="bio" cols="75" rows="10" wrap="virtual">write your answer here</textarea></td></tr>\n";
echo "<tr><td><input type="submit" value="Go To The Next Step"></td>";
echo "<td><input type="reset" value="Restart This Step"></td></tr>\n";
echo "</table><p> </p><p> </p>\n";
echo "</center></body></html>";
// this is unfinished!!!!!!
}elseif($step==4){
// this is unfinished!!!!!!
echo "<html><head><title>FindYourDesire signup step 4</title></head>\n";
echo "<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4"><center>\n";
echo "\n\n<h1>THIS IS A TEST. IT DOES NOT HAVE A DATABASE CONNECTION NOR DOES IT CHECK USERNAMES. THIS LINE WILL BE REMOVED IN THE REAL ONE </h1>\n\n";
echo "<p>Thank you for your interest in joining FindYourDesire.com. We need to know some things about you in order to make your profile here. Any feild in <font color="#ff6500">ORANGE</font> is required. Any feild marked with an * is confidential and will NOT show up in your user stats. Any feild with a 0 will not show up in your usser stats, but is collected for the "Desired" member's dating services' search.</p>\n";
echo "<p><form name="step4" action="signup.php" method="POST" onsubmit="validate();">\n";
echo "<input type="hidden" name="uid" value="$uid"><input type="hidden" name="step" value="5">";
echo "<table frame="void" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0">\n";
echo "<tr><td>Your <a name="#confcode" href="#confcode" onClick="window.open('faq.php?seek=confcode', 'faq', 'width=500,height=250,scrollbars=yes');">Confirmation Code</a></td><td><input type="text" name="conf" size="25"></td></tr>\n";
echo "<tr><td>Upload your main picture</td><td><input type="file" accept="image/jpeg" name="main" size="75"></td></tr>\n";
echo "<tr><td>Upload Thumb 1</td><td><input type="file" accept="image/jpeg" name="thumb1" size="75"></td></tr>\n";
echo "<tr><td>Upload Thumb 2</td><td><input type="file" accept="image/jpeg" name="thumb2" size="75"></td></tr>\n";
echo "<tr><td>Upload Thumb 3</td><td><input type="file" accept="image/jpeg" name="thumb3" size="75"></td></tr>\n";
echo "<tr><td>Upload Thumb 4</td><td><input type="file" accept="image/jpeg" name="thumb4" size="75"></td></tr>\n";
echo "<tr><td>Upload your <a name="#salute" href="#salute" onClick="window.open('faq.php?seek=salute', 'faq', 'width=500,height=250,scrollbars=yes');">salute</a></td><td><input type="file" accept="image/jpeg" name="salute" size="25"></td></tr>\n";
echo "<tr><td><input type="submit" value="Go To The Next Step"></td>";
echo "<td><input type="reset" value="Restart This Step"></td></tr>\n";
echo "</table><p> </p><p> </p>\n";
echo "</center></body></html>";
// this is unfinished!!!!!!
}elseif($step==5){
// this section is done
echo "<html><head><title>FindYourDesire signup step 5</title></head>\n";
echo "<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4"><center>\n";
echo "<p>You have completed the sign up. Your profile should be accessible, but the pictures need to be approved. You may <a href="login.php">Log In</a> at any time. The photo approers should review your photos shortly. be sure to visit the forums after you sign in for the full FindYourDesire experience!</p>\n";
echo "<div align="right">- FindYourDesire Administration</div>\n";
echo "</body></html>\n";
}else{
echo "<html><head><title>FindYourDesire signup</title></head>\n";
echo "<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4"><center>\n";
echo "<h1>There was an unforseen error. if you passed step 2, please alert the administration by posting in the problems forum. Otherwise, click <a href="signup.php?step=1">here</a> to restart.</h1>\n";
echo "</body></html>\n";
}}else{
echo "<html><head><title>FindYourDesire signup</title></head>\n";
echo "<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4"><center>\n";
echo "<h1>There was an unforseen error. if you passed step 2, please alert the administration by posting in the problems forum. Otherwise, click <a href="signup.php?step=1">here</a> to restart.</h1>\n";
echo "</body></html>\n";
}Code: Select all
byCode: Select all
[/size]
if anyone could let me know how to email the password and username along with the uid which we plan on doubling as a way to validate the e-mail address, i would appreciate that. my home server is red hat linux 9
one of the things i will ask of the hosting company is if they are using a posix compatible os with sendmail.just a side-note: for large blocks of (almost) static html you might leave the php block. Anything outside a php block will be sent to the client as is, even in a loop (or another code-block)
imho this is much more readable:
Code: Select all
<?php
for ($i=0; $i!=6; $i++)
{
?>
<hr /><!-- ok that's nonsens but it's only an example -->
<?php
}
?>Code: Select all
<?php
// this is unfinished!!!!!!
/* create session information */
$uid=uniqid(microtime(),1); // make a unique id
session_start(); // start a session
$SESSION['uid']=$uid; // set the uid for the session and validation code
?>
<html>
<head>
<title>FindYourDesire Sign up step 1</title>
</head>
<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4">
<center>
<h1>THIS IS A TEST. IT DOES NOT HAVE A DATABASE CONNECTION NOR DOES IT CHECK USERNAMES. THIS LINE WILL BE REMOVED IN THE REAL ONE </h1>
<p>Thank you for your interest in signing up for FindYourDesire.com. before you can sign up, you need to agree to a few baisc terms of service</p>
<form name="step1" action="signup.php" method="POST" onsubmit="javascript:validate();">
<input type="hidden" name="uid" value="<?php echo $uid; ?>" />
...