Momenteel gebruik ik onderstaande script om in te loggen. Nu zou ik echter ook graag weten wanneer iemand mijn calculatiemodule gebruikt. Is het mogelijk om simpelweg de datum + het tijdstip ook weg te schrijven naar de database?
PHP:
<?php session_start();
include('connection.php');
//Definieer variabelen
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$name=$_POST['name'];
$company=$_POST['company'];
$email=$_POST['email'];
$lang=$_POST['lang'];
//Controleer of het formulier is ingevuld en verstuurd moet worden
if(empty($name)){
echo "<b>Please fill out your name. Return to the form with your browsers \"back\" button.</b><br />\n";}
else{
if(empty($company)){
echo "<b>Please fill out your company name. Return to the form with your browsers \"back\" button.</b><br />\n";}
else{
if(empty($email)){
echo "<b>Please fill out an E-mail adress. Return to the form with your browsers \"back\" button.</b><br />\n";}
else{
if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))){
echo "<b>Please fill out a valid E-mail adress. Return to the form with your browsers \"back\" button.</b><br />\n";}
else{
if(empty($lang)){
echo "<b>Please fill out your language. Return to the form with your browsers \"back\" button.</b><br />\n";}
else {
$sql="INSERT INTO klant (name,company,email,lang) VALUES('$name','$company','$email','$lang')";
$query=mysql_query($sql) or die ("Kon de query niet uitvoeren");
$_SESSION['semail'] = $email;
$_SESSION['slang'] = $lang;
header ("Location: $lang/page1.php");
} } } } }
}else{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Z-Matic Calculator</title>
<!--CSS styles-->
<link rel="stylesheet" type="text/css" href="css/main.css" />
<link rel="stylesheet" type="text/css" href="css/form.css" />
<!--Javascripts-->
<script type="text/javascript" src="js/form.js"></script>
</head>
<body><form method="post">
<!-- Begin Wrapper -->
<div id="wrapper">
<!-- Begin Header -->
<div id="header"><h1>Calculator</h1></div>
<!-- End Header -->
<!-- Begin Naviagtion -->
<div id="navigation">
Progress image / animation
</div>
<!-- End Naviagtion -->
<!-- Begin Content -->
<div id="content">
<table cellpadding="5" cellspacing="5">
<tr>
<td id="maintable">Naam / Nom / Name</td>
<td><input class="widthed" name="name" type='text' onfocus='showElem("help1");' onblur='hideElem("help1");'/></td>
<td id='help1' class="popup" style="display:none;">A name must be filled out to proceed</td>
</tr>
<tr>
<td id="maintable">Bedrijf / Societé / Company</td>
<td><input class="widthed" name="company" type='text' onfocus='showElem("help2");' onblur='hideElem("help2");'/></td>
<td id='help2' class="popup" style="display:none;">A company name must be filled out to proceed</td>
</tr>
<tr>
<td id="maintable">Email</td>
<td><input class="widthed" name="email" type='text' onfocus='showElem("help3");' onblur='hideElem("help3");'/></td>
<td id='help3' class="popup" style="display:none;">A valid e-mail adress must be filled out to proceed</td>
</tr>
<tr>
<td id="maintable">Taal / Langue / Language</td>
<td align="left" valign="middle">
<select class="widthed" name="lang" onfocus='showElem("help4");' onblur='hideElem("help4");'>
<option selected="selected"></option>
<option value="NL">Nederlands</option>
<option value="FR">Français</option>
<option value="GB">English</option>
</select></td>
<td id='help4' class="popup" style="display:none;">Please choose your language</td>
</tr>
</table>
</div>
<!-- End Content -->
<!-- Begin Continue -->
<div id="continue">
<input name="submit" type="submit" value="Verder" id="continue_button" class="button"/>
</div>
<!-- End Continue -->
<!-- Begin Footer -->
<div id="footer">Footer</div>
<!-- End Footer -->
</div>
<!-- End Wrapper -->
</form>
</body>
</html>
<?php
}
?>