php not getting one html variable in a form
Posted: Mon Jun 30, 2003 12:54 pm
on top of the orginal question (below) i'm wondering about (db--username check related) when mysql says it retuns false if it doesn't get anything, is that the same as NULL in php? i'm wondering because if so then i know how to check the username against the db (check to see if i can return anything when querying for the username) if not, does it return the string 'false' or a number (generally 0 from my experience)?
this is a multiple step form. in step 4, the step variable isn't being passed.
i can't figure out why. is this a php issue or an html issue?
text display of full code: http://people.brandeis.edu/~m3rajk/JMT/ ... signup.txt
code in action: http://people.brandeis.edu/~m3rajk/JMT/ ... signup.php
step 4:
Code: Select all
<?php
$db=mysql_connect(/* stuff to connect */);
$user=mysql_query("select * from main-user-table where username=$un", $db);
if($user!==NULL){
$err=TRUE; $errs[]='the username you desire is already in use, please choose a new username';
}?>i can't figure out why. is this a php issue or an html issue?
text display of full code: http://people.brandeis.edu/~m3rajk/JMT/ ... signup.txt
code in action: http://people.brandeis.edu/~m3rajk/JMT/ ... signup.php
step 4:
Code: Select all
}elseif(($step==4)&&($err)){ # an error was found in step4
bgnpg('no', $step); errreport($step, $errs); s4();
}elseif($step==4){ # get the validation code and let them upload pics
bgnpg('no', $step); s4();
function bgnpg($cookie, $step){
if($cookie=='yes'){ # set the cookie with the validation code
$conf=md5(uniqid(microtime(),1)); # make unique id
$expire=time()+60*60; # set expiration an hour from now
setcookie(confcode, $conf, $expire); #create cookie
}
if($step==3){
$un=md5($_POST['un']);
$expire=time()+60*60; # set expiration an hour from now
setcookie(un, $un, $expire);
}
?><html>
<head>
<title>FindYourDesire.com Signup page -- <? echo $step; ?></title>
<meta name="Author" content="coded by: Josh Perlmutter; images by Morgan O'Brien-Bledsow & Tamara Collette all rights reserved">
<style type="text/css">
<!-- this comment is for non-css compliant browsers
{text-decoration=none}
end of css -->
</style>
</head>
<body bgcolor="#000000" text="#c8c8c8" alink="#fc00ff" vlink="#00e0c4" link="#ffffff">
<center><p> </p>
<!-- banner goes here -->
<!-- ad bar goes here -->
<?php
}
function errreport($step, $errs){
if($step==1){ # report errors in step1
foreach($errs as $err){
echo " <h1><font color="#ff0000">YOU MUST AGREE TO THE $err!</font></h1>";
}
}elseif($step==2){ # report errors in step2
foreach($errs as $err){
echo " <h1><font color="#ff0000">$err</font></h1>";
}
}else{ # report errors of step4
foreach($errs as $err){
$val=$_POST['conf'];
echo "<h1>debug line: validation code submitted: $val</h1>";
echo " <h1><font color="#ff0000">$err</font></h1>";
}
}
}
function s4(){
?> <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 joining FindYourDesire.com. We need to know some things about you in order to make your profile here. Any feild in <font color="#ff0000">RED</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 user stats, but is collected for future features. You will be notified before they are used.</p>
<h2>NOTE: MAXIMUM PICTURE SIZE IS 150 KB</h2>
<form enctype="multipart/form-data" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
<input type="hidden" name="step" value="5"><input type="hidden" name="MAX_FILE_SIZE" value="153600">
<table frame="void" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" text="#c8c8c8">
<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>
<tr><td>Upload your main picture</td><td><input type="file" accept="image/jpeg" name="main" size="25"></td></tr>
<tr><td>Upload Thumb 1</td><td><input type="file" accept="image/jpeg" name="t1" size="25"></td></tr>
<tr><td>Upload Thumb 2</td><td><input type="file" accept="image/jpeg" name="t2" size="25"></td></tr>
<tr><td>Upload Thumb 3</td><td><input type="file" accept="image/jpeg" name="t3" size="25"></td></tr>
<tr><td>Upload Thumb 4</td><td><input type="file" accept="image/jpeg" name="t4" size="25"></td></tr>
<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>
<tr><td><input type="submit" value="Go To The Next Step"></td><td><input type="reset" value="Restart This Step"></td></tr>
</table>
</center>
</body>
</html>
<?php
}