ASKER
<?PHP
$table=$_GET['table'];
$ip = $_SERVER['REMOTE_ADDR'];
$today = date('F j, Y, g:i a, T');
$id=$_GET['id'];
// variables above are carried over from another php webpage
// store the document signature information
if (isset($_POST['lease_signed_fname'])):
$signed_fname = $_POST['signed_fname'];
$signed_lname = $_POST['signed_lname'];
$lease_ip = $_POST['l_ip'];
$lease_date = $_POST['l_date'];
$sql = "UPDATE $table SET
signed_fname='$signed_fname',
signed_lname='$signed_lname',
l_ip='$l_ip',
l_date='$l_date'
WHERE id='$id'";
if (@mysql_query($sql)) {
echo '<p>Document Signed Successfully</p>';
} else {
echo '<p>ERROR Signing Document: ' .
mysql_error() . '</p>';
}
// gather existing information from the database
$f=@mysql_query("SELECT * FROM `table1` , table2 WHERE `email` = '$email' AND `guest` = `field`");
if (!$f) {
exit('<p> Error fetching details: ' .
mysql_error() . '</p>');
}
$f=mysql_fetch_array($f);
// guest's name already stored in the database
$fname=$f['fname']; // First name stored in table1
$lname=$f['lname']; // Last name stored in table1
//Other necessary fields listed below
?>
<head>
<script type="text/javascript">
function validate(form) {
// checking to make sure the document has been signed and that they have agreed to the terms
// See if the first name was entered
if (form1.lease_signed_fname.value ==""){
alert("You have not signed the document.");
return false;}
// See if the last name was entered
if (form1.lease_signedlfname.value ==""){
alert("You have not signed the document.");
return false;}
// See if they have agreed to the terms and conditions
if(!document.form1.agree.checked){alert("Please Check I Agree to the terms and conditions.");
return false; }
return true;
}
</script>
</head>
<!-- page text goes here -->
<!-- user must accept the page text below -->
<table align="center"><form action="<?php echo $_SERVER['PHP_SELF']; ?>?id=<?php echo $id; ?>" method="post" name="form1" onsubmit='return validate(this)'>
<tr>
<td>
Current Date & Time:
</td>
<td>
<input type="text" name="l_date" value="<?php echo $today; ?>" size="30" readonly="true" />
<!-- Dynamically created -->
</td>
</tr>
<tr>
<td>
Your IP Address:
</td>
<td>
<input name="l_ip" type="text" value="<?php echo $ip; ?>" size="30" readonly="true" />
<!-- Dynamically created -->
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type=checkbox name=agree value='yes'> I agree to the terms and conditions.
</td>
</tr>
<tr>
<td>
Your Signiture (First Name, Last Name):
</td>
<td>
<input type="text" name="signed_fname" value="<?php echo $signed_fname; ?>" size="30" /> <input type="text" name="signed_lname" value="<?php echo $signed_lname; ?>" size="30" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input name="sign-document" type="submit" value="Sign Document" />
<!-- Now compare $signed_fname that the user entered to $fname stored in the database -->
<!-- Now compare $signed_lname that the user entered to $lname stored in the database -->
</form>
</td>
</tr>
</table>
ASKER
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY