473,602 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to retain the value of form??

16 New Member
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 5741
Markus
6,050 Recognized Expert Expert
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
sweetline priya
16 New Member
@Markus
why the symbol '@' here?? can you explain!
Feb 17 '09 #3
sweetline priya
16 New Member
@Markus
can u clarify one more doubt!! how to retain value for combo box???
Feb 17 '09 #4
Markus
6,050 Recognized Expert Expert
@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 Recognized Expert Expert
@sweetline priya
How are you generating your select element?
Feb 17 '09 #6
sweetline priya
16 New Member
@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 Recognized Expert Expert
@sweetline priya
Is this a multi select or single select?
Feb 18 '09 #8
sweetline priya
16 New Member
@Markus

its a single select only..
Feb 18 '09 #9
Markus
6,050 Recognized Expert Expert
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
5495
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 enters disappears everytime the form is refreshed when posting it to itself. Is there anyway I can retain the values that were entered on the form?
2
3112
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 created.(all values are set to zero) What i need to do is retain the value of a textbox(a total)on the clear input form(total from previous day)
2
4880
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 tags then 5 dropdownlist controls each containing the 5 Xml text tags). Problem,when I save the user DropDownList selected items by means of a button click the web form looses the PlaceHolder viewstate and generates the following error..."Object...
3
3337
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 a lot of overhead and I would like to move the overhead to the remote client's PC, using javascript. Thank you for your assistance. Respectfully,
2
1679
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 posts. I then retrieve the text using Request.Form. The problem I am facing is in retaining whitespaces in the text the user has entered. Assume that the user has entered the following text in the JavaScript prompt dialog (note the whitespaces...
2
2003
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' > <input type='submit' value='SEARCH' name='search' > </form> but when i click the submit button it can't retain the id value in it's field. so is there any way to retain it's value after pressing the submit value. please try to send response...
3
3135
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 there is something missing or the values are incorrect. <input type="text" name="camount" tabindex="4" value="<?php echo $form->value("camount"); ?>" > When i edit this information i retrieve the value in the following manner <input...
2
12228
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 to the page after round trip when using UpdatePanel? In the following code snippet the ViewState is killed when I click page refresh or when I go some page and revert back Code Snippet: // Default.aspx:
1
2611
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 session_start(); // Start the session where the code will be stored. ?> <html>
0
7993
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.