lundi 13 avril 2015

Adding a user session to a table?

Im trying to add the user session to a table that is filled in when they complete a form. I would then like to display the form only they created on their home page.



<?php
require_once("/extlib/vdaemon/vdaemon.php");

require_once("./core/config.php");


?>


<html>
<head>
<style type="text/css">
body {
background: #e4e4e4;
}

.form {
width: 600px;
margin: 0 auto;
background: #fff;
padding: 45px;
border: 1px solid #c2c2c2;
}

.error {
color: #AA0000
}
.controlerror {
background-color: #ffffdd;
border: 1px solid #AA0000;
}

.input {
width: 300px;
height: 35px;
margin-left: 10px;
}
</style>
</head>
<body>
<div class="form">
<?php
$msg = $_GET['msg'];

if ( $msg == '1' ) {
echo '<p>Your information was submitted successfully.</p>';
}
?>

<form action="core/process.php" method="post" id="registration" >
<input type="hidden" name="formID" value="Product_Tracker" />

**<input type="hidden" name="id_user" value="$_SESSION['id_user']" />**

<p>Name of product:<input type="text" name="Name of Product" class="input" />

<p>Please select the tests that were done on the product.</p>
<p>In Circuit Test (ICT): Yes: <input type="radio" name="ICT" value="yes" /> No: <input type="radio" name="ICT" value="no" /></p>
<p>Visual Inspection: Yes: <input type="radio" name="Visual Inspection" value="yes" /> No: <input type="radio" name="Visual Inspection" value="no" /></p>
<p>XRAY: Yes: <input type="radio" name="XRAY" value="yes" /> No: <input type="radio" name="XRAY" value="no" /></p>
<p>Automated Optical Inspection (AOI): Yes: <input type="radio" name="AOI" value="yes" /> No: <input type="radio" name="AOI" value="no" /></p>
<!--<p>Checkbox1 <input type="checkbox" name="checkbox" value="checkbox1" /> Checkbox2: <input type="checkbox" name="checkbox" value="checkbox2" /></p>-->



<input type="submit" value="Submit" />
<p>
<a href='access-controlled.php'>Back</a>
</p>
</form>
</div>
</body>
</html>
<?php VDEnd(); ?>


When i look on mymphpadmin when the form gets created the id_user is $_SESSION['id_user'] and not the name of the user that created it.


Aucun commentaire:

Enregistrer un commentaire