well i'm getting sloser now, it loads up and no errors come up on submit but nothing gets put in the db
<center>
<table width=50% border=1 cellspacing=0 cellpadding=1 valign="top">
<form method="post" action="<? $PHP_SELF ?>">
<?
$id = $_GET['id'];
$login = $_POST['login'];
$_POST['id'];
$_POST['login'];
printf("<tr><td bg color=\"#666666\"><p>ID</p></td><td align=center><p>".$_SESSION["session"]["id"]."</p></td></tr>");
printf("<tr><td bg color=\"#666666\"><p>Username</p></td><td align=center><p>".$_SESSION["session"]["login"]."</p></td></tr>");
$db = mysql_connect("localhost","user","ps");
mysql_select_db("dv6couga_Address",$db);
$sql = "SELECT * FROM users WHERE login='$login'";
$result = mysql_query($sql);
$number_results = mysql_num_rows($result);
$myrow = mysql_fetch_row($result);
if ($number_results==0) {
printf ("<tr><td bgcolor=darkgray><p>Your username:</p></td><td align=center><input type=Text name=login></td></tr>");
printf ("<tr><td bgcolor=darkgray><p>Your name:</p></td><td align=center><input type=Text name=fname></td></tr>");
printf ("</table>");
} else {
printf ("<tr><td bgcolor=darkgray><p>Your username:</p></td><td align=center><input type=Text name=login></td></tr>");
printf ("<tr><td bgcolor=darkgray><p>Your name:</p></td><td align=center><input type=Text name=fname></td></tr>");
printf ("</table>");
}
?>
<input type="hidden" name="id" value="<?=$_POST['id']?>">
<input type="hidden" name="username" value="<?=$_POST['username']?>">
<br><input type="Submit" name="submit" value="Update">
</form>
<?php
if (isset($_POST['submit'])) {
echo "<table width=300>";
echo "<tr><td><p>" . $_GET['login'] . "</p></td></tr>"; // pull out of the url using $_GET
echo "</table>";
}
?>
there'st he short version of my script, cut out a lot in the forms but that should not matter.....
here's my login script
include_once("config.php");
// Check user not logged in already:
checkLoggedIn("no");
// Page title:
$title="Dv6cougar's Login Page!!!";
// if $submit variable set, login info submitted:
if($_POST["submit"]) {
//
// Check fields were filled in
//
// login must be between 4 and 15 chars containing alphanumeric chars only:
field_validator("login name", $_POST["login"], "alphanumeric", 4, 15);
// password must be between 4 and 15 chars - any characters can be used:
field_validator("password", $_POST["password"], "string", 4, 15);
// if there are $messages, errors were found in validating form data
// show the index page (where the messages will be displayed):
if($messages){
doIndex();
// note we have to explicity 'exit' from the script, otherwise
// the lines below will be processed:
exit;
}
// OK if we got this far the form field data was of the right format;
// now check the user/pass pair match those stored in the db:
if( !($row = checkPass($_POST["login"], $_POST["password"])) ) {
// login/passwd string not correct, display error:
$messages[]="Incorrect login/password, try again";
}
// if there are $messages, errors were found in validating form data
// break from this if loop to display login page with the errors:
if($messages){
doIndex();
exit;
}
// if we got here, no errors - start a session using the info
// returned from the db:
cleanMemberSession($row[login], $row[password]);
// and forward user to members page (populate session id in URL):
header("Location: members.php?".session_name()."=".session_id());
} else {
doIndex();
}
// This function displays the default 'index' page for this script:
function doIndex() {
// import the global $messages array.
// if any errors were detected above, they will be stored
// in the $messages array:
global $messages;
// also import the $title for the page - note normally just declare
// all globals on one line - ie global $messages, $title
global $title;
// drop out of PHP mode to display the plain HTML:
?>
<html>
<head>
<base target="_parent">
<link rel="stylesheet" type="text/css" href="main.css">
<title><?=$title?></title>
</head>
<?php doCSS()?>
<body>
<?php
// if there are any messages stored in the $messages array, call the displayErrors
// function to output them to the browser:
if($messages) { displayErrors($messages); }
?>
<form method="post" action="<? $PHP_SELF ?>">
<table class="login" width="190">
<tr><td class="navcell"><font face="Java" size="3"color="blue">Username:</font><input type="text" size="12" name="login" value="<?php print $_POST["login"] ?>" maxlength="15"></td></tr>
<tr><td class="navcell"><font face="Java" size="3" color="blue">Password:</font><input type="password" name="password" value="" maxlength="15" size="12"></td></tr>
<tr><td class="navcell" align="right"> <input name="submit" type="submit" value="Submit"></td></tr>
</table>
</form>
</body>
</html>
<?php
}
if (isset($_POST['submit'])) {
echo "<table width=300>";
echo "<tr><td><p>" . $_GET['login'] . "</p></td></tr>"; // pull out of the url using $_GET
echo "</table>";
}
?>
any ideas?
thanks