Credit Cards - Loans - Loans - Pool tables - Mortgage

PDA

View Full Version : $_POST wont return a value


rianne809
Dec 3rd 2007, 7:42 pm
Hi guys, im currently new in php programming, i have read some php tutorials and so i created a login script, my problem is the $_POST variable wont return any data, how is this so, below is my script

<?php
// check for cookies
if (isset($_COOKIE['logcheck'])){
header("Location: index.html");
}else{
$usernam= "some username";
$passwod="";
$database="some database";

mysql_connect(localhost,$usernam,$passwod);
@mysql_select_db($database) or die( "Unable to select database");

$user = $_POST['formtext1'];
$pass = $_POST['formtext2'];

$query = "SELECT * FROM nsuser WHERE usr_name='$user'";
$result = mysql_query($query);

$num = mysql_num_rows($result);

mysql_close();

if ($num==0){
header("Location: errorlog.html");
}else{
$passcheck = mysql_result($result,0,"usr_pass");
if ($pass==$passcheck){
// set logcheck cookies valid for 1 minute
setcookie("logcheck","yes",time()+60);
header("Location: index.html");
}else{
header("Location: reports_error.html");
}
}
}
?>

ive' tried to echo the $user variable to find out its value, but the page return was blank, does it means that there is no value for it? Srry for being a noob here :o


btw, here is my form code:

<form name="form1" method="POST" action="log.php" enctype="text/plain">
<input name="formtext1" type="text" id="formtext1" style="position:absolute;width:142px;left:64px;top:183px;z-index:8">
<input name="formtext2" type="password" id="formtext2" style="position:absolute;width:145px;left:62px;top:223px;z-index:9">
<input name="formbutton1" type="submit" value="Submit" style="position:absolute;left:98px;top:261px;z-index:12">
</form>

thenetninja
Dec 3rd 2007, 7:50 pm
i got it, your enctype is not multipart (in the form code) =)

rianne809
Dec 3rd 2007, 7:57 pm
Its working now yey =) , geez im so noob lol, thanks a lot, i bet youll be hearing a lot from me soon lol

thenetninja
Dec 3rd 2007, 7:59 pm
i'll remember to attach a 0500 number to my profile for that sort of help lol