By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

Seeding back the field values in html form

P: 2
Hi All,
This is my first post and I am just stuck in my assignment. I am trying to create a single page which basically check whether a name field or text field includes text or not and display message accordingly. There are three field one drop down, two text field.
Now to access the name field I have to refresh the page I am basically using some php code to validate this field on the top of the form. Now whenever I refresh the page I loose all data but it does display the error message though.

Now the problem is how I will keep the data in the field and refresh the page.? And display yhe message as well.?

I have to do this through PHP only.

Thanx to all....!!!!!!
Sep 28 '08 #1
Share this Question
Share on Google+
3 Replies


Markus
Expert 5K+
P: 6,050
When you say 'refresh' are you sending the form? If so, you can just use the $_POST array to fill the fields.
Sep 28 '08 #2

P: 2
When you say 'refresh' are you sending the form? If so, you can just use the $_POST array to fill the fields.
Hi markus.
Thanx for the reply, is it possible to set value of fields in html through php. I had looked around in the internet but i didnt find a way i can set field value through php.

Please guide //


Thanx
Sep 28 '08 #3

Markus
Expert 5K+
P: 6,050
Hi markus.
Thanx for the reply, is it possible to set value of fields in html through php. I had looked around in the internet but i didnt find a way i can set field value through php.

Please guide //


Thanx
You set the value of an input by the value attribute
Expand|Select|Wrap|Line Numbers
  1. <input type="text" value="some value" />
You could set the value by php, assuming the POST array contains data, by doing this:
Expand|Select|Wrap|Line Numbers
  1. <input type="text" value="<?php if(isset($_POST['value']){ echo $_POST['value'];}?>
You would obviously have to adapt this.
Sep 28 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.