473,385 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to retain the value of form??

hi friends..

in my page the form contains 10 textboxes. the user has to fill these textfields.

if the user made any mistake in entering value in any textbox, in the button click, a message is displayed to intimate the user like ' u wrongly enter the value'.. in button click all the textbox values are erased. so can anybody tell me how to retain the value of textbox(without GET method because it is an unsecured one.. since all the values are displayed in address bar)

and i need to retain in the same page, without moving to some other page... can anybody help me plz.....
Feb 17 '09 #1
9 5728
Markus
6,050 Expert 4TB
Well are you using POST? If so, your data will still be in the POST array (if you submit to the same page). So, for your input's value attribute, just echo the value from the POST array.

Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="username" value="<?php echo @$_POST['username']; ?>" />
  2.  
Feb 17 '09 #2
@Markus
why the symbol '@' here?? can you explain!
Feb 17 '09 #3
@Markus
can u clarify one more doubt!! how to retain value for combo box???
Feb 17 '09 #4
Markus
6,050 Expert 4TB
@sweetline priya
The '@' symbol simply suppresses an error - the error here being an 'undefined index' error. I would not recommend using it on just anything - we can be sure this error will not cause any failures, so we can escape it. We could use isset() to check for the variable, but that's more writing ;)
Feb 17 '09 #5
Markus
6,050 Expert 4TB
@sweetline priya
How are you generating your select element?
Feb 17 '09 #6
@Markus
i am using following coding to retrieve data from database...

Expand|Select|Wrap|Line Numbers
  1. $sql=mysql_query("SELECT system_type FROM systemtype ",$con);
  2. for($i = 0; $i < mysql_num_rows( $sql ); $i++)
  3. {
  4. $tmp = mysql_fetch_row( $sql );
  5. print("<OPTION value=\"$tmp[0]\">$tmp[0]</OPTION>\n");
  6. }
Feb 18 '09 #7
Markus
6,050 Expert 4TB
@sweetline priya
Is this a multi select or single select?
Feb 18 '09 #8
@Markus

its a single select only..
Feb 18 '09 #9
Markus
6,050 Expert 4TB
Have a look at this thread. See what you can learn from that, and then post what you've tried.

- Markus.
Feb 18 '09 #10

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

Similar topics

1
by: J P Singh | last post by:
I have simple form where user enter the search criteria and the form is posted back to itself and runs a query based on the values that are entered. Everything is expect the values that the user...
2
by: kevin carter | last post by:
Hi we have a form that accepts inputs from the user at the end of the day the data that has been input is stored on a table,(all textboxes are bound to the table) THe next day a clear form is...
2
by: theo | last post by:
Hi... I wish to extract the text content of an Xml file and assign it to DropDownList controls at runtime.I can get the Xml file text content into the DropDownList controls (Ex...if 5 Xml text...
3
by: ANTISPAM_garycnew_ANTISPAM | last post by:
What is the simplest way to retain the last option value selected in an html select object using javascript? I am currently using a server-side cgi language to accomplish this task, but it adds...
2
by: rn5a | last post by:
When a Button is clicked in a Form, the JavaScript 'prompt' dialog pops-up for users to enter any text. When the user clicks OK in the prompt dialog, the text is populated in a TextBox & the Form...
2
by: farukcse | last post by:
Dear sir, i am using below of this code for searching and viewing data from database. <form name='search_form' method = 'POST' action='' > <input type=text name='id_no' value='' maxlength='10'...
3
by: raaman rai | last post by:
Hi Fellas, i need to understand how to retain the submtted form values during an Edit/Update operation. When i add the information from a form, i retain the form values in the following way incase...
2
by: qwedster | last post by:
Folks! The following is a "Hello World" kind of code for ViewState. I just want to know how to retain the ViewState 1) while Page Refresh when using UpdatePanel and also 2) While I reverting back...
1
by: zhtway | last post by:
Hi, I am very very new to web programming and I want to retain data once the form is submitted. I tried other says but no luck. Could someone point it out for me please? <?php...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.