I guess first off i should ask if this is possible...makes sense that it is O.o
I have my form set up, and when the submit button is pressed, the form goes blank, including the name field...but i would like the name field to remain with the same name (as the person will fill out a bunch of these forms, so it would make sense they dont have to enter their name everytime...)
i just dont know how to keep the info stored, and able to be called again (i think..)
Up at line 1, i have:
<?php
session_start();
$_SESSION['name'] = $_POST['Name']; // store name
?>
and here is the part that handles the submit being pressed (may be a bit messy )
<?php
mysql_connect("$server",$username,$password) or die ("Unable to connect to server");
@mysql_select_db($database) or die("Unable to select database");
if(isset($_POST['submit'])) {
$Name= $_SESSION['name'];
$Date=$_POST['Date'];
$Hours=$_POST['Hours'];
$Phase=$_POST['Phase'];
$ProjectID=$_POST['ProjectID'];
$ProjectName=$_POST['ProjectName'];
$Description=$_POST['Description'];
$Client=$_POST['Client'];
$Type=$_POST['Type'];
if(isset($_Post['Invoiced'])){
$Invoiced = "Yes";
} else {
$Invoiced = "No";
}
$query1 = "INSERT INTO tblTimesheet VALUES ('','$Name', '$Date','$Hours','$Phase','$Invoiced','$ProjectID','$Description')" ;
#$query2 = "INSERT INTO tblProjects VALUES('$ProjectID','$PName', '$Client', '$Type' )";
if(($results = mysql_query($query1))){#&&($results = mysql_query($query2))) {
echo '<font color="green">Data successfully added</font>';
} else {
die('<font color="red">Error: '.mysql_error().'</font>');
}
}
?>
But yeah, the NAME field is cleared along with the rest of the list when the submit button is hit...so how do i make it stay?
Thanks!
Paul