It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

Retain what user inputted

Moderator: Malcolm

Retain what user inputted

Postby jeaddy on Wed Jul 09, 2008 12:50 am

Hello everyone,

I created a simple userform to test. What I wanted to do is have the user input a field,
and then click on the submitted button once the submitted button is click
the page refresh and still retain what the user input (it is not lost).

I know that to do this, we have to use the isset function, which I did, but it didn't work.

Here are my codes, please provide some suggestion and code examples.
[php]
Code:

<html>
<head>
<title></title>
</head>

<body>

<form method ="post" action="">

<table border = 1 >

<tr>
<td>


<?php session_start(); $firstname = (isset($_POST['firstname']));
$lastname = (isset($_POST[lastname]));?>
First Name: <input name="firstname" type="text" value='<?php $firstname ?>'/></td>
</td>
</tr>


<tr>
<td>
Last Name: <input name="lastname" type="text" value="' . $lastname . '"/></td>
</td>
</tr>

<tr>
<td>
<input name="submit" type="submit" value="Enter the information">

</tr>
</td>[/php]



thanks,
jeaddy
 
Posts: 24
Joined: Thu Dec 20, 2007 12:35 am

Postby willyamPax on Wed Jul 16, 2008 6:55 am

try this to ur input:

<input name="firstname" type="text" value="<?php echo $firstname;?>"/>
<input name="lastname" type="text" value="<?php echo $lastname;?>"/>

hope this will help u...
make sure u put action...like PHP_SELF
make sure there is an end to ur <?php just like i see on the first line
and u cannot put an html code inside the php code unless u echo it..
willyamPax
 
Posts: 4
Joined: Mon Jul 14, 2008 1:27 am


Who is online

Users browsing this forum: No registered users and 1 guest