Im currently using CodeIgniter for my webpage and I am trying to make the radio button to be selected if the locked_status is locked and vice versa. I have data that is passed to the view and I want to use the data to check if the locked_status is either locked or not. The user is able to change the locked_status and when the form is submitted, the data is updated accordingly when the form is submitted. I'm trying to use javascript but I do not know how to retrieve the data and check it. Or is there any other better way to do this?
my controller loading view and passing the data to view.
function userInformation($userName)
{
$this->load->model("agentDB_model");
$data['results'] = $this->agentDB_model->getSelectedAgentDetails($userName);
$this->load->view("viewAgentInfo_view", $data);
}
view
<!DOCTYPE html>
<html lang="en">
<head>
<title>Welcome</title>
</head>
<body>
<div id="content">
<h1>Home Page</h1>
<p>Selected Agent Information</p>
</div>
<?php
foreach($results as $row)
{
$userName = $row->userName;
$userPassword = $row->userPassword;
$agencyName = $row->agencyName;
$agencyCodeNo = $row->agencyCodeNo;
$invalidLoginCount = $row->invalidLoginCount;
$locked_status = $row->locked_status;
$logged_in = $row->logged_in;
}
/*
if($row->locked_status == 0)
{
$locked_status = "Avalaible";
}
else if($row->locked_status == 1)
{
$locked_status = "Locked";
}
*/
?>
<?php echo form_open('site/updateValues') ?>
User Name: <input type="text" name="tbx_userName" value="<?php echo "$userName"?>" readonly/></br>
User Password: <input type="password" name="tbx_userPassword" value="<?php echo "$userPassword"?>"/></br>
Agency Name: <input type="text" name="tbx_agencyName" value="<?php echo "$agencyName"?>"/></br>
Agency Code Number: <input type="text" name="tbx_agencyCodeNo" value="<?php echo "$agencyCodeNo"?>"/></br>
Invalid Login Count: <input type="text" readonly name="tbx_invalidLoginCount" value="<?php echo "$invalidLoginCount"?>"/></br>
Locked Status: <input type="radio" name="locked_status" id="lock">Lock
<input type="radio" name="locked_status" id="unlock">Unlock
<br/>
<!--<input name="tbx_locked_status" value="<?php echo "$locked_status"?>" readonly/></br> -->
Logged In: <input type="text" readonly name="tbx_logged_in" value="<?php echo "$logged_in"?>" /></br>
<input type="submit" value="Submit"/>
</form>
<div id="footer">
<p>Copyright (c) 2012 basicsite.com</p>
</div>
</body>
</html>
Try this one
<!DOCTYPE html>
<html lang="en">
<head>
<title>Welcome</title>
</head>
<body>
<div id="content">
<h1>Home Page</h1>
<p>Selected Agent Information</p>
</div>
<?php
foreach($results as $row)
{
$userName = $row->userName;
$userPassword = $row->userPassword;
$agencyName = $row->agencyName;
$agencyCodeNo = $row->agencyCodeNo;
$invalidLoginCount = $row->invalidLoginCount;
$locked_status = $row->locked_status;
$logged_in = $row->logged_in;
if($row->locked_status == 0)
{
$locked_status = "<input type="radio" name="locked_status" checked value=0 id="lock">Locked <input type="radio" name="locked_status" id="unlock" value=1> Unlocked";
}
else if($row->locked_status == 1)
{
$locked_status = " <input type="radio" name="locked_status" value=0 id="lock"> Locked <input type="radio" name="locked_status" checked id="unlock" value=1> Unloacked";
}
}
?>
<?php echo form_open('site/updateValues') ?>
User Name: <input type="text" name="tbx_userName" value="<?php echo "$userName"?>" readonly/></br>
User Password: <input type="password" name="tbx_userPassword" value="<?php echo "$userPassword"?>"/></br>
Agency Name: <input type="text" name="tbx_agencyName" value="<?php echo "$agencyName"?>"/></br>
Agency Code Number: <input type="text" name="tbx_agencyCodeNo" value="<?php echo "$agencyCodeNo"?>"/></br>
Invalid Login Count: <input type="text" readonly name="tbx_invalidLoginCount" value="<?php echo "$invalidLoginCount"?>"/></br>
Locked Status: <?php echo $locked_status; ?>
<br/>
Logged In: <input type="text" readonly name="tbx_logged_in" value="<?php echo "$logged_in"?>" /></br>
<input type="submit" value="Submit"/>
</form>
<div id="footer">
<p>Copyright (c) 2012 basicsite.com</p>
</div>
</body>
</html>
Related
This code is intended to just take an ID and Pass without any kind of authentication and remember the data if the checkbox were to be checked. I can not figure it why is it not saving the data to cookies.
<?php
if(isset($_POST["chk"],$_POST["id"],$_POST["pass"])) {
$id=$_POST["id"];
$pwd=$_POST["pass"];
if (isset($_POST["chkbx"])){
setcookie("id","$id",time()+3600);
setcookie("pwd","$pwd",time()+3600);
$id=$_COOKIE["id"];
$pwd=$_COOKIE["pwd"];
}
print "Your ID " . $id;
print "Your PASS ". $pwd;
}
?>
<html>
<head>
<title>
Remember Me
</title>
</head>
<body>
Please Enter ID and PASS
<form method="post" >
Enter ID
<input type="text" name="id" />
Enter PASS
<input type="text" name="pass" />
<input type="submit" value="submit" /><br>
<input type="checkbox" name="chkbx" />Remember Me
<input type="hidden" name="chk" value="true" />
</form>
</body>
</html>
You code is correct but it needs to clean it up
in this part I add a condition to check is there is anything first in the $_COOKIE
before print it
if(isset($_COOKIE['id']) && isset($_COOKIE['pwd'])){
print "Your ID: " . $_COOKIE['id'] . '<br>';
print "Your PASS: ". $_COOKIE['pwd'] . '<br>';
}
your code will be like this
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$id = $_POST["id"];
$pwd = $_POST["pass"];
if (isset($_POST["chkbx"])){
setcookie("id", $id ,time()+3600);
setcookie("pwd", $pwd, time()+3600);
}
}
if(isset($_COOKIE['id']) && isset($_COOKIE['pwd'])){
print "Your ID: " . $_COOKIE['id'] . '<br>';
print "Your PASS: ". $_COOKIE['pwd'] . '<br>';
}
?>
<html>
<head>
<title>
Remember Me
</title>
</head>
<body>
Please Enter ID and PASS
<form method="post" >
Enter ID
<input type="text" name="id" value="<?= isset($_COOKIE['id'])? $_COOKIE['id']: '' ?>" />
Enter PASS
<input type="text" name="pass" value="<?= isset($_COOKIE['pwd'])? $_COOKIE['pwd']: '' ?>" />
<input type="submit" value="submit" /><br>
<input type="checkbox" name="chkbx" />Remember Me
<input type="hidden" name="chk" value="true" />
</form>
</body>
</html>
I have a code. Somehow, it only able to pick the last hidden input name field instead of the other one. I also tried use if and else but nothing is displayed. Please advise.
Without the if else cases scenario:
HTML:
<div class="tab-label">
<input type="radio" id="ldktech_product_good" name="conditition" value="good" >
<input type="hidden" id="ldktech_product_price_good" name="price" value="7.50">
<label for="ldktech_product_good">Good</label>
NOTE: Please include the charger with your iPad trade-in, or a replacement fee will be deducted from the offer
<div class="tab-label">
<input type="radio" id="ldktech_product_flawless" name="conditition" value="flawless" >
<input type="hidden" id="ldktech_product_price_flawless" name="price" value="10">
<label for="ldktech_product_flawless">Flawless</label>
PHP:
$condition = $_POST["conditition"];
$price = $_POST["price"];
echo $price;
echo "<br>";
echo $condition;
With the if else scenarios:
HTML Code:
<div class="tab-label">
<input type="radio" id="ldktech_product_good" name="conditition" value="good" >
<input type="hidden" id="ldktech_product_price_good" name="price-good" value="7.50">
<label for="ldktech_product_good">Good</label>
<div class="tab-label">
<input type="radio" id="ldktech_product_flawless" name="conditition" value="flawless" >
<input type="hidden" id="ldktech_product_price_flawless" name="price-flawless" value="10">
<label for="ldktech_product_flawless">Flawless</label>
PHP code:
$condition = $_POST["conditition"];
if($condition == "good"){
$price = $_POST["price-good"];}
else if ($condition == "flawless"){
$price = $_POST["price-flawless"];}
echo $price;
echo "<br>";
echo $condition;
Nothing work. Please advised
works fine for me. don't know if your form method is post or not or your action url is set to your script url or if your script is on the same page make sure you place it accordingly.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PhpFiddle Initial Code</title>
</head>
<body>
<div style="margin: 30px 10%;">
<h3>My form</h3>
<form id="myform" name="myform" method="post">
<div class="tab-label">
<input type="radio" id="ldktech_product_good" name="conditition" value="good" >
<input type="hidden" id="ldktech_product_price_good" name="price-good" value="7.50">
<label for="ldktech_product_good">Good</label>
<div class="tab-label">
<input type="radio" id="ldktech_product_flawless" name="conditition" value="flawless" >
<input type="hidden" id="ldktech_product_price_flawless" name="price-flawless" value="10">
<label for="ldktech_product_flawless">Flawless</label> <br /><br />
<button id="mysubmit" type="submit">Submit</button><br /><br />
</form>
</div>
<?php
if(isset($_POST["conditition"])){
$condition = $_POST["conditition"];
if($condition == "good"){
$price = $_POST["price-good"];
}
else if ($condition == "flawless"){
$price = $_POST["price-flawless"];
}
echo $price;
echo "<br>";
echo $condition;
}
?>
</body>
</html>
I believe this is what you're trying to do?
EDIT:
<form method="post">
<div class="tab-label">
<input type="radio" name="condition1" value="good">
<input type="hidden" name="price1" value="7.50">
<label for="ldktech_product_good">Good</label>
</div>
<div class="tab-label">
<input type="radio" name="condition2" value="flawless">
<input type="hidden" name="price2" value="10">
<label for="ldktech_product_flawless">Flawless</label>
</div>
<input type="submit" name="submit" value="Get records">
</form>
<?php
if (isset($_POST['submit'])) {
if (isset($_POST['condition1']) && $_POST['condition1'] == "good") {
echo "You have selected :".$_POST['price1']; // Displaying Selected Value
} else if (isset($_POST['condition2']) && $_POST['condition2'] == "flawless") {
echo "You have selected :".$_POST['price2']; // Displaying Selected Value
}
}
?>
I need to create a form, which will check if the input is empty or not. If it is empty there should be a text like "Required field". There is a notice saying, that surName has an undefined index.
Here is my PHP code
<?php
$name_error="";
$sname_error="";
$f_name="";
$s_name="";
if (isset($_POST['submit_button'])) {
if ($_POST['firstName']!=='') {
$f_name=$_POST['firstName'];
}
else {
$name_error="Required Field *";
}
}
if ($_POST['surName']!=='') {
$s_name=$_POST['surName'];
}
else {
$sname_error="Please fill this out";
}
?>
<html>
<head>
<title>Registration form</title>
</head>
<body>
<div class="head">
<p>Registration Form</p>
</div>
<form action="Register/final.php" method="POST">
<label for="firstName">First Name</label><br>
<input type="text" name="firstName" placeholder="First Name" value="<?php echo $f_name; ?>"><br><br>
<p style="color: red;"><?php echo $name_error; ?></p>
<label for="surName">Last Name</label><br>
<input type="text" name="surName" placeholder="Last Name" value="<?
php echo $s_name;?>"><br><br>
<p style="color: red;"><?php echo $sname_error;?></p>
</form>
</body>
</html>
well for starters, you could use the built-in HTML5 input validator required
<input type="text" required>
This will provide that nice user message on submit asking them to please fill out that field.
Secondly, you can check on the server using empty instead of if ($_POST['surName']!=='')
if ( !empty($_POST['surName']) ) {
// your logic here
}
The functionality is basically there already...
I guess the } bracket for if (isset($_POST['submit_button'])) { should be just before ?>
There is missing something like <input type="submit" name="submit_button" value="Register">
And considering what Jeff Puckett II says
So, if I do the changes 1 and 2 to your code, it might look like this:
<?php
$name_error="";
$sname_error="";
$f_name="";
$s_name="";
if (isset($_POST['submit_button'])) {
if ($_POST['firstName']!=='') {
$f_name = $_POST['firstName'];
} else {
$name_error="Required Field *";
}
if ($_POST['surName']!=='') {
$s_name = $_POST['surName'];
} else {
$sname_error="Please fill this out";
}
}
?>
<html>
<head>
<title>Registration form</title>
</head>
<body>
<div class="head">
<p>Registration Form</p>
</div>
<form action="Register/final.php" method="POST">
<label for="firstName">First Name</label><br>
<input type="text" name="firstName" placeholder="First Name" value="<?php echo $f_name; ?>"><br><br>
<p style="color: red;"><?php echo $name_error; ?></p>
<label for="surName">Last Name</label><br>
<input type="text" name="surName" placeholder="Last Name" value="<?php echo $s_name;?>"><br><br>
<p style="color: red;"><?php echo $sname_error;?></p>
<input type="submit" name="submit_button" value="Send">
</form>
</body>
</html>
It is because you've put the surName validation outsite of submit conditional;
`
if (isset($_POST['submit_button'])) {
if ($_POST['firstName']!=='') {
$f_name=$_POST['firstName'];
}else{
$name_error="Required Field *";
}
if ($_POST['surName']!=='') {
$s_name=$_POST['surName'];
}
else{
$sname_error="Please fill this out";
}
}
?>`
Your can improve this a little bit by using an associative array like this errors = array(); and then $errors['surName'] = "this is field is required";
You don't have a submit button. Another thing is that you didn't use your if statement of $_POST['surName'] after submit. You can use it like this :
<?php
error_reporting(1);
$name_error = "";
$sname_error = "";
$f_name = "";
$s_name = "";
if (isset($_POST['submit_button']))
{
if ($_POST['firstName'] != '')
{
$f_name = $_POST['firstName'];
}
else
{
$name_error = "Required Field *";
}
if ($_POST['surName'] != '')
{
$s_name = $_POST['surName'];
}
else
{
$sname_error = "Please fill this out";
}
}
?>
<html>
<head>
<title>Registration form</title>
</head>
<body>
<div class="head">
<p>Registration Form</p>
</div>
<form action="Register/final.php" method="POST">
<label for="firstName">First Name</label><br>
<input type="text" name="firstName" placeholder="First Name" value="<?php echo $f_name; ?>"><br><br>
<p style="color: red;"><?php echo $name_error; ?></p>
<label for="surName">Last Name</label><br>
<input type="text" name="surName" placeholder="Last Name" value="<?php echo $s_name;?>"><br><br>
<p style="color: red;"><?php echo $sname_error;?></p>
<input type="submit" name="submit_button" value="Register">
</form>
</body>
</html>
i'm still newbie in php, i want to connect this three page. I want to know how to tansfer data from signup to pfofile and also the sign in page. I tried to use tag but not working.
page=signup
<body>
<?php
// define variables and set to empty values
$email = $username = $name = $contact = $birthday = $gender = $address = $password = $payment ="";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$email = test_input($_POST["email"]);
$username = test_input($_POST["username"]);
$name = test_input($_POST["name"]);
$contact = test_input($_POST["contact"]);
$birthday = test_input($_POST["birthday"]);
$gender = test_input($_POST["gender"]);
$address = test_input($_POST["address"]);
$password = test_input($_POST["password"]);
$payment = test_input($_POST["payment"]);
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<div id="login">
<form id="registeration" method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<fieldset>
<legend><h1>Registeration</h1></legend>
<p>Email:<br/>
<input type="email" name="email"></p>
<p>Username:<br/>
<input type="text" name="username" />
</p>
<p>Your Name:<br/>
<input type="text" name="name"/></p>
<p>Contact Number:<br/>
<input type="text" name="contact"/></p>
<p>Birthday:<br/>
<input type="date" name="birthday">
<p>Gender:<br/>
<input type="radio" name="gender" value="male"/>Male
<input type="radio" name="gender" value="female"/>Female
</p>
<p>Address: <br/>
<textarea name="address" cols="50"></textarea></p>
<p>Password:<br/>
<input name="password" type="password" size="50"/></p>
</p>
<h2>Choose payment method:<br/></h2>
<p><input type="radio" name="payment" value="cod"/>CASH ON DELIVERY</p>
<p><input type="radio" name="payment" value="Online Banking"/>ONLINE BANKING : CIMB Clicks<br/>
<p><input type="radio" name="payment" value="Online Banking"/>ONLINE BANKING : Maybank<br/>
<p><input type="radio" name="payment" value="Online Banking"/>ONLINE BANKING : BSN<br/>
<p><input type="radio" name="payment" value="atm"/>ATM</p>
<p><button type="submit" value="submit">Submit</button><span> <span><span><span><span>
<button type="reset" value="cancel">Cancel</button></p>
</fieldset>
</form>
</div>
echo $email;
echo "<br>";
echo $username;
echo "<br>";
echo $name;
echo "<br>";
echo $contact;
echo "<br>";
echo $birthday;
echo "<br>";
echo $gender;
echo "<br>";
echo $address;
echo "<br>";
echo $password;
echo "<br>";
echo $payment;
?>
</body>
page=signin
<body>
<div id="login">
<fieldset>
<legend><h1>Login</h1></legend>
<form id="signin" method="POST">
<p>Username:<br/>
<input type="text" name="username"/></p>
<p>Password:<br/>
<input type="password" name="password"/></p>
<p><button type="submit" value="submit">Submit</button><span>
<button type="reset" value="cancel">Cancel</button></p>
</form>
</fieldset>
<!-- end .content --></div>
<?php
error_reporting(0);
if (!empty ($_POST)){
if ($_POST ["username"] == NULL){
echo "Please insert your username!";}
else{
$strusername=$_POST["username"];
echo "<p>$strusername</p>";
}}
if (!empty ($_POST)){
if ($_POST ["password"] == NULL){
echo "Please insert the password!";}
else {
$strpassword=$_POST["password"];
echo "<p>$strpassword</p>";
}}
?>
</body>
page=profile
<body>
<div class="container">
<div class="content">
<table>
<td colspan="5"><b>PROFILE</b></td>
<tr>
<td><div align="left">Username:</div></td><td><?php echo $username ?></td></tr>
<td><div align="left">Name:</div></td><td><?php echo $name ?></td></tr>
<td><div align="left">Username:</div></td><td><?php echo $username ?></td></tr>
<td><div align="left">Birthday:</div></td><td><?php echo $birthday ?></td></tr>
<td><div align="left">Contact Number:</div></td><td><?php echo $contact ?></td></tr>
<td><div align="left">Gender:</div></td><td><?php echo $gender ?></td></tr>
<td><div align="left">Address:</div></td><td><?php echo $address ?></td></tr>
<td><div align="left">My payment Method:</div></td><td><?php echo $payment ?></td> </tr>
<tr>
<td><div align="left"><button type="submit" value="Edit Profile" >Edit Profile</button></div> </td>
</tr>
</table>
<!-- end .content --></div>
<!-- end .container --></div>
</body>
Well, Try to use the post and get.
The PHP superglobals $_GET and $_POST are used to collect form-data.The example below displays a simple HTML form with two input fields and a submit button:
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
When the user fills out the form above and clicks the submit button, the form data is sent for processing to a PHP file named "welcome.php". The form data is sent with the HTTP POST method.
To display the submitted data you could simply echo all the variables. The "welcome.php" looks like this:
<html>
<body>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</body>
</html>
The output could be something like this:
Welcome John
Your email address is john.doe#example.com
The same result could also be achieved using the HTTP GET method:
<html>
<body>
<form action="welcome_get.php" method="get">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>
and "welcome_get.php" looks like this:
<html>
<body>
Welcome <?php echo $_GET["name"]; ?><br>
Your email address is: <?php echo $_GET["email"]; ?>
</body>
</html>
I Suggest you to follow this tutorial here
I hope it will help you, best regards
Use $_SESSION
In every page start with <?php session_start(); ?>
then store $_SESSION['email'] = test_input($_POST["email"]);
Then in any page you can use echo $_SESSION['email'];
You should use SESSION for simple login functionality....
refer this tutorial about basic login and functionality
I am using below code for a html form.(it has two forms) I am able to keep the textarea field after the first and second form submission. but issue I am facing here is the dropdown menu selection.
Code:
<html>
<body>
<div class="emcsaninfo-symcli-main">
<form id="form1" name="form1" action=" " method="post" >
<div class="input">Your Name</div>
<div class="response"><span><input class="textbox" id="myname" name="myname" type="text" value="<?php if(isset($_POST['myname'])) { echo htmlentities ($_POST['myname']); }?>" /></span> </div>
<div class="input">Your Place</div>
<div class="response"><span><input class="textbox" id="myplace" name="myplace" type="text" value="<?php if(isset($_POST['myplace'])) { echo htmlentities ($_POST['myplace']); }?>" /></span> </div>
<div class="input-quest">Graduation Status</div>
<div class="input-resp"><select id="graduation" name="graduation" OnChange="CMT();"><option class="dropdown-options">Graduate</option><option class="dropdown-options">Non Graduate</option></select></div>
<div class="submit">
<input id="first_submit" type="submit" name="first_submit" value="first_submit" />
</div>
</form>
<?php
if(!empty($_POST['myname']) && !empty($_POST['myplace']) || !empty($_POST['output_textarea'] ) )
{
$myname = $_POST['myname'];
$myplace = $_POST['myplace'];
$graduation = $_POST['graduation'];
?>
<form id="form2" name="form2" action=" " method="post" >
<textarea onclick="this.select()" name="output_textarea" id="output_textarea" cols="100" rows="25" readonly value="<?php if(isset($_POST['output_textarea'])) { echo htmlentities ($_POST['output_textarea']); }?>">
<?php
echo "My name is $myname and I am from $myplace, and I am $graduation";
?>
</textarea>
<input id="submit1" type="submit" name="name_field" value="submit1" />
<input id="submit2" type="submit" name="place_field" value="submit2" />
<input id="myname_hidden" name="myname" type="hidden" value="<?php if(isset($_POST['myname'])) { echo htmlentities ($_POST['myname']); }?>"/>
<input id="myplace_hidden" name="myplace" type="hidden" value="<?php if(isset($_POST['myplace'])) { echo htmlentities ($_POST['myplace']); }?>" />
<input id="graduation_hidden" name="graduation" type="hidden" value="<?php if(isset($_POST['graduation'])) { $graduation = $_POST['graduation']; }?>" />
</form>
<?php
function name()
{
echo $_POST["output_textarea"];
}
if(isset($_POST['name_field']))
{
name();
}
function place()
{
echo $_POST["output_textarea"];
}
if(isset($_POST['place_field']))
{
place();
}
}
?>
</div>
</html>
</body>
For example if I put name = John, place : UK and selecting graduation status as graduate, it will will give me first form output as in my output textarea
My name is John and I am from UK, and I am Graduate
I have two seperate submit button for second form, using that I am doing some other function with help of the output textarea
If I press any of the second button,I m able to keep entries my name and place area, but it not keeping the dropdown selection. so it will only display like after submitting submit1 or submit2
My name is John and I am from UK, and I am
Here,
How can I keep the the dropdown selection also with the output text area
Will I able to show only the output_textarea content after second form submission without keeping the first form data ?
PHP FIDDLE
You have an error in logic in the hidden input for the "graduate" element.
This is what you have at lines 53-55. Line 55 doesn't have an echo instead it has an $graduation = $_POST['graduation']; which won't help you:
<input id="myname_hidden" name="myname" type="hidden" value="<?php if(isset($_POST['myname'])) { echo htmlentities ($_POST['myname']); }?>"/>
<input id="myplace_hidden" name="myplace" type="hidden" value="<?php if(isset($_POST['myplace'])) { echo htmlentities ($_POST['myplace']); }?>" />
<input id="graduation_hidden" name="graduation" type="hidden" value="<?php if(isset($_POST['graduation'])) { $graduation = $_POST['graduation']; }?>" />
instead of that, this code should work:
<input id="myname_hidden" name="myname" type="hidden" value="<?php if(isset($_POST['myname'])) { echo htmlentities ($_POST['myname']); }?>"/>
<input id="myplace_hidden" name="myplace" type="hidden" value="<?php if(isset($_POST['myplace'])) { echo htmlentities ($_POST['myplace']); }?>" />
<input id="graduation_hidden" name="graduation" type="hidden" value="<?php if(isset($_POST['graduation'])) { echo htmlentities($_POST['graduation']); }?>" />