Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Form Values Disappearing


I have a form which users are supposed to enter information into

Naturally there is an extensive error-checking on the form-input.

If an user eg. forgets to enter information into a field an errorpage will be included with the information. Normally it would be possible to press the back-button of the browser to return to the form holding the values of which it was submitted.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Values Of Variables Disappearing
I have the following code in a file which works without problem. I am just testing out things for a GD based image generation project I have. PHP Code:

Comparing User Input Values In A Form With Database Values
I want to compare user input values in a form with my database.
Basically I want to check whether the user exits in my database.
What mysql command can do that?

2nd Half Of String Disappearing
I'm passing strings from one page to another. Basically, users vote for their top 10, and their votes are displayed on the next page. The things they vote for are school names. Everything is ok, if they do the standard voting.

However, if the users can't find an option they like, they can vote for "OTHER". Then they are taken to an intermediate page, where their picks are displayed except their is a text box for them to fill in for the OTHER school. Everything on this form is displayed correctly.

However, once they submit this form, when they go to the final page with all of their picks displayed anyschools that had two word names, ie Lousiana State are now only displayed as one word ie Lousiana. This baffles me because on the page previously, it says Louisiana State correctly. All I'm doing is then passing this variable as a hidden type to the final page. Does hidden truncate second words for some reason? I have magic quotes off.

Parts Of Page Disappearing
I have a message board page that displays one page of one forums' messages using pagination. It all works really well unless there are no messages in which case nothing below the bit in the pagination code that echoes 'first prev [1] [2] ... next last' is shown.

Below this section I have the form to add a thread and some links, but they aren't shown because of this problem in the script. This means that the first message in each forum can only be put in from PhpMyAdmin or by a script I make specifically for it. Code:

Add Form Field Values Into Php Seesion Variable Before Submitting The Form
I have php page which is basically a simple html form containing some text fields.The user will type in values in it and submit it .Now what i want is that just at the time of submittion i want to assign the form field values in session variables.

I nwwd this b'coz the form is being submitted into a cgi script which has been given to me.Now the cgi script is an executable one and i am unable to view or change its content,Its functionability is to change a password for a linux user account .Now the cgi script after completing the job is redirected to another html page.What i have to do is that i need to trap the user input and update the values in a mysql database .Now if i can assign the values in a session variable then i can do the updatation from some later pages.

Form Submission Fills Form Values With Garbage
I'm attempting to do some form processing on a server that has register_globals off, however, I've run into a confusing situation and need some help.

Basically, the form is a multi-part/form-data form as I have it upload a file in addition to submit a number of other fields, but the error I have occurs even when no upload is done.

When I submit the form, all my input field variables get filled with garbage. Here's the html before submission for one of the fields: Code:

Values From A Form
I have a form (search.html) that has 1 textbox and 3 listboxes. When I submit this form to a php file (search_res.php), I am using $HTTP_POST_VARS to get the values which is fine.

But then in my php file(search_res.php) I again have a listbox with 2 options. When I choose either one of these options to display the search results either by "Price" or "Name" I lose the values of the main form (search.html). How can I keep these values from the main form in my search_res.php page?

Getting Form Values
I have so far been trying to get all selected check boxes on the page, quantity text fields and ordernotes text area to INSERT INTO my database but to no avail. Im using OBDC to add to the confusion.

I've tried to develop my 'product' script into some kind of a form, but now need to find out how to make the data i want variable so that i can send them into my database. Code:

Remember Form Values
I have a form, and I'm using PHP to make sure the users filled in certain fields. If they haven't filled in a field, they are brought back to the form after submitting (using header location) and asked to fill it in. However, when they go back, the form values are all gone.

How can I keep the form values there? I know i've seen it done, but I can't remember where.

Retaining Form Values
I have the form values set to value="<? php echo $Name ?>".

I need to allow a person to access a presentation from within this test form if for example they are unsure of an answer they can return back to the presentation.

I need to retain what they have answered on the form b4 they choose to go out to presentation when they come back. If they only use the back button, values are retained but if they reselect to take the test, I loose all.

I need to save values off when they select link back. Can anyone give me an easy way. I guess I could write to D.B. file with save values and read back in but is there a simpler way?

Saving Form Values
I want to fill in a form in php and for some fields i would like to go to another php page within the same frame. There i can lookup a key to place into a formfield in the previous php page. Well when i return with the lookupped value all the values already entered in this page are missing. So i was trying to save this values temporary within $_SESSION vars. I filled this with a javascript (with an onblur-function) but i am unable to manipulate the $_SESSION vars within javascript. Because php is serverbased.

Remembery Form Values!
I have seen a lot of posts around here lately on how to remember form values after the user hits "submit" [so that they can be corrected]. Well the method that I use is very simple: I store my form in a function, and then when I need to display it I just call that function. After a presses submit, I just display the form the submitted values in it. PHP Code:

HTTP Form Values
On one page I have checkboxes being selected and then submited via a form post. The problem is the values and names of the checkboxes change each time the script is ran. So I have to know what they are to call them on the next page. Is there any way to retrieve all the HTTP passed variables in php that where passed without knowing the variable name?

Passing Values From A Form
I want to know how can i pass values from a html page/form(php) to an applet i.e the values obtained from the form is used as parameters in the applet.

Retaining Form Values
How to retain the values in form tag ,in case user enter wrong
information.

Refill Form Values
How do other sites make it so that when you fill out a form and you mess something up (e.g. the password / verify password are not the same), the values are still in the input box?

I could throw out a bunch of sites that do this... even registering for this forum, web.com, and almost every other place. For a while firefox would autosave it on my site so that when you click back it is waiting for you, but i put in this javascript / php text replacement thing that interferes with that because it generates an image every time the page is loaded so it is not all in the cache or something like that...

Transfering Values From One Form To Another
I have two html pages the first one has email, and name input s. the second page should have amoung other things these two info.

I want to display this name and email into the apropriate inputs of the second page while it is being loaded

I already assigned those values to variables in php file but my concern is mainly how to use them.

Getting Form Values Without Using $_POST
I just started supporting my first php app, and am attempting to set up a development copy locally on my pc. In some places in the application, forms are submitted and the values retrieved w/o the use of $_POST['inputname'] (the form method is post.)

This works on the production site, but not locally. I've made sure the php.ini is the same, and I can't find any other hints as to why this might be. Using PHP5 w/ Apache 2.

I don't want to have to modify a bunch of working code I'm not yet familiar with to get it to work on my pc, thought maybe this would be a no-brainer for the experts. Sample code below. Code:

Multiple Values In A Form - Array
So the problem is:

I have a form wich passes some values to a new page, the problem is the filed name is ever the same but the values changes. But the value passed is always the last one. PHP Code:

Declaring Array In A Form And Getting Its Values
I have this form and I want to store some of the values in arrays. I want a 2 dimensional array. If not possible, 1 will be okay. e.g. $myarray[][];

I want to now use a form and store values in it.
Item 1.1: <INPUT TYPE="TEXT" NAME="myarray[0][0]" VALUE" ">
Item 1.2: <INPUT TYPE="TEXT" NAME="myarray[0][1]" VALUE" ">

Item 2.1: <INPUT TYPE="TEXT" NAME="myarray[1][0]" VALUE" ">
Item 2.2: <INPUT TYPE="TEXT" NAME="myarray[1][1]" VALUE" ">

etc. Is this possible and what is the best way to implement this. The reason I am doing this is because I want to have an SQL statement that goes in a loop manner Code:

Updating Form Values Without Submit
This seems very simple, but I'm not sure how to do it. Lets say that I
have
a form with two select boxes, call them Colours (red, orange, yellow)
and Items (contents depend on colour selected). If the colour is
changed from orange to yellow, I want the second select box to change
it's contents from "Oranges, etc" to "Bananas, etc" without the submit
button being pressed. How do I do this?

Values Not Displaying In Second Form After Post.
I have two forms that are used to collect user information. The first one
takes user inputted values such as fullname, city, address etc. I want these
values to display in the second form when it is called. Both forms are .htm
files that call themselves when the submit button is press via the following
command in each form:

<form method="post" action="<?php $server['PHP_SELF']?>">

The server is set to parse .htm files as php. Everything else is working
fine and all the validation checks are working fine. Based on certain
validation checks that are within the form php code, the user is either left
on the input form page to correct errors or if there are no errors the user
is passed to the next form via a Java call....

<script language="javascript">
<!--
location.replace("order2.htm");
-->
</script>

I have even put a session_write_close() before the redirect hoping this
would fix the problem of not displaying the inputted values from the first
form into the second form.

The server value for global variables is set to ON.

In the second form I have tried to display the values from the first form
after the POST using the following three methods:

$fullname;
echo $HTTP_POST_VARS['fullname'];
echo $_POST['fullname'];

Nothing works...

Values From Form Via Associative Array
I have a form which has a text field and a select box. There are many other fields also in the form . I need get the value of the text field or the select box, depending on which one has a value. Additionally it has to give the value only from the text field even if there is a selection made from the select box. I know that i can get post values from form like this: PHP Code:

Use A Button To Reset Form Values
How can I reset the initial form variables that are set with session
statements when clicking on a button?

I tried this but the function was not called:
<?PHP
function reset_form($none) { $_SESSION = array(); }
?>

<form enctype="multipart/form-data" name="company_info" method="post"
action="add_pic.php">

<input type="text" name="co_name" value ="<?PHP echo $_SESSION['co_name'];
?>" >

<input type="reset" value="Reset" onClick ="<?PHP reset_form();?>">

</form>

Send PHP Values By Web Form Mail
Is that possible to send out the php values by web form?

for example:
<?php echo $x_price;?>

<?php
if ($x_departure!= NULL) {
$sqlwrk = "SELECT * FROM `departure`";
$sqlwrk .= " WHERE `departureID` = " . $x_departure;
$rswrk = mysql_query($sqlwrk);
if ($rswrk && $rowwrk = mysql_fetch_array($rswrk)) {
echo $rowwrk["departurePort"];
}
@mysql_free_result($rswrk);
}
?>

Values In Form Not Passed Using Onclick ?
i have a php file name main.php i want to do a post and not a get since this action is to delete a row in the database. however, when i try to do a href onclick, the values are not passed to the main.php. why ? Code:

echo "You have " .$votesattach. " votes for this quote. Delete the Quote and Votes ?";
echo "<form name=send1 method=post action=main.php?action='deleteit'>";
echo "<input type=hidden name=action value=deleteit>";
echo "<input type=hidden name=which value=$delete>";
echo "<input type=hidden name=userno value=$userno></form>";
echo "<a href=main.php onclick=document.send1.submit()>YES</a>";}

how do i do pass values to the server using a post method ?

Retrieving The Multiple Values Set By A Form
I am passing a form to a php script for further processing.

I am able to retrieve the last value set for that given form variable
using
$variable=$_REQUEST['form_variable'];

My question is, what is the Php way of retrieving all the values passed
for the same form variable?

For example, if the php script is called with a syntax like

http://xxxx/get_variables.php?form_...riable=variable

, how do I iterate through all the values that form_variable has been
set to?

Form Obtaining Values For Process
I have a form which has a while loop inside to echo a table. But not only that i have a submit button and a check box which I want to have the value of the row's ID so that if the submit button is pressed it will delete the adjacent row.. but just curious if this following idea is going to work : Code:

Validation Using Multiple Values In Value Form Tag
I'm creating a form that will create fixtures for a school games system with php and mysql. I have 3 drop down menus on a form Pupil1, Pupil2 and Game. The form displays data from the mysql database such as Name, House and class in a drop down menu which links to a process form.

This is a extract from the drop down menu, (row0 is the students id number, row2 is the students house)

echo"<option style='background: yellow' value='$row[0] $row[4]'>Name: $row[1] $row[2] | Class: $row[3] | House: $row[4]</option>";

On the process form I would like to validate that people from the green house can only play people from the yellow house which is the $row[4] in the value section but I don't know how to separate the id which is row0 and the house (row4) in the value tag. I can't find any contains tag such as if 'select1' contatains 'yellow'{do this},

Dynamic Form - How To Set Values Of A List
I have a form with a list/menu in it that is populated with records from a database. The items in list#2 are based upon what is selected in list#1.

I have been able to use a combination of php and javascript to get it to work, but the javascript reloads the page to get list #2 to refresh - and that clears out any other fields that have been filled in. Instead of javascript being called for the 'onchange' event for list #1, I'd rather it call php when list#1 is changed and so reset the values in list#2.

OPTIONS:
1. I thought I could have a php function that is called (i.e.   onchange="<?php reload();?>" but I can't figure out how to set the values of the list from within the php function. How to reference form objects with php?

Storing Form Values For Questionnaire
I have been able to output the questions from the database but do not know how to implement the part which requires me to make another php file that retrieves each answer from the radio button and stores them in a databse for a unique user.

Im not sure where the userid of the person doing the questionnaire will be retrieved a as have not yet coded this. But my system needs to know whose doing the questionnaire and what asnwers they have seletced. Code:

Updating Multiple Form Values To MySQL
i am building a content management system for my employer's Web site, which is a daily newspaper. haven't had too much trouble learning PHP up to this point, but I have a problem now that I am finding difficult to figure out. any help would be much appreciated.

I have two MySQL tables for a Poll on our site, one named PollQuestions and one named PollAnswers. I am trying to build an administration form that will allow the user to pull up both the question and answers for any given poll and edit them if they need to. I haven't had a problem with the Poll Question, but with the Poll Answers, I am unsure how I can pull each Poll Answer into a text field and update all of them in one query based on an ID field for the answers.

In other words, I have each answer pulling into the form from the database and for each answer, i have a hidden field that stores that particular answer's ID number.

So how do I update all of the answers in one query based on that particular answer's ID number? I have written the following code, but it does not work. Any help would be much appreciated.

For the form itself, here is the code for the Answer text fields:

How PHP $_POST Gets The Multiple Values From A HTML Form?
I am try test a simple HTML form with PHP

<form method=POST action="testing.php">
Cat <input type="checkbox" name="pet" value="cat">
Dog <input type="checkbox" name="pet" value="dog">
Pig <input type="checkbox" name="pet" value="pig">
<br>
<select name="dates" multiple>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
</select><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>

When I checked cat, pig and selected Tuesday and Saturday from the form
and click submitt

My testing.php is

<?php
$pet = $_POST['pet'];
$dates = $_POST['dates'];
print_r($pet);
var_dump($dates);
?>

The $_POST['pet'] and $_POST['dates']
are NOT return as array nor multiple
strings seperated with a comma.
It only return the LAST string I have
checked and/or selected.

How do I get the multiple values from the
checkbox and the multiple select from a
HTML form in PHP?

Textarea Problem In Form: Values Not Recognised
In a php form that should be send by email, I have been puzzling the whole
night long about the fact that the content of a textarea was not passed
through the email message. Curiously enought it worked when I omitted the
standard text in the text area, so
<textarea name = "reaction">Please give your reaction here</textarea>
the value $reaction in my mailform script remained empty.
<textarea name = "reaction"></textarea>
however, worked properly.
I detected this by coincidence because I had written almost a similar script
for another site but without default values in the text area. I couldn't
find any explanation for this behaviour on the web.


Passing Values Using Drop Down Menu To Same Form.
how I am able to do this without the use of a "submit" button - ie onchange. Here is what I am working with.

<form name="form1" method="post" action="">
<select name="MyNumber">
<option value="One">One</option>
<option value="Two">Two</option>
<option value="Three">Three</option>
<option value="Four">Four</option>
<option value="Five">Five</option>
</select>
<input type="submit" name="Submit" value="Submit">
</form>

<?php @print ($MyNumber);?>

Problem On IE Refreshing Form Elements Values
I have this problem I canīt solve.

Iīm using some mix of javascript / php / ajax code to open a text
file, process its info and close it.

While skiping through the text file lines, Iīd like some of myForm
elements be updated with the info extracted from the file.

This way, the user realice that actually some process is being executed
and forgets about "oh ! this isnīt working, I'll try closing and
opening the app again".

Here is some part of the HTML code:

<FORM name="myForm" id="myForm" method="POST" >

<INPUT type="text" name="employee" id="employee">

<INPUT type="button" name="btnProcess" id="btnProcess"
onclick="xajax_ProcessFile();" >

</FORM>

and part of my ProcessFile() php function should look like:

$h = fopen($file_name,"rb") ;

while( ($fld = fgetcsv($h, 35," ")) !== FALSE ) {
$emp = $fld[0] ;

$objResponse->addScript("document.getElementById('employee').value='$emp'");
}
fclose($h);
return $objResponse->getXML();

Updating A Slew Of Values Into MySQL From A Form
I'm working on a script to edit stored values which I will call on to change the appearence of certain parts of my website. I figured that I can store default values in MySQL, echo those values into a form, then edit whichever values I want, and have it updated in MySQL. However, I can't get the updating into MySQL part to work.

The form displays everything the way it should, including the current values in the database. When I try updating it, instead of using the new value, it instead inserts blank space. I *think* it's because of my query, but I don't see why it shouldn't work, since I did define $values = $_POST['values'] at the top of the script. I don't know if it's my logic that's off, or my code, but I would appreciate any assistance. PHP Code:

Blank Form Not Producing NULL Values
I have the following PHP script which is a data entry form for a MySQL database: PHP Code:

Retrieve Array From FORM List Of Values?
I have created a form where a user selects 2 items from a list of 8 values.
That form field is called "choices" and returns a value to the php file as
$choices. This form posed no problem when I only allowed a single item to be
selected, but the client now needs to have 2 items selected at a time.

The problem I'm having is that I don't know how to turn the multiple
selections on the form in to an array. I thought the $choices variable
would automatically become an array, but
Using[color=blue]
> for ( $i = 0; $i<2; $i++ )
> echo "$choices[$i] ";[/color]
only returns the first two letters of the last selected item value.

And
[color=blue]
> foreach($choices as $articles)
> echo $articles. ' ' ;[/color]

Returns an invalid argument.

While echo $choices returns the second item selected in the list, but not
the first.
It appears that the variable is replacing the first item selected with the
second rather than returning an array.

Posting Form List Multiple Values ?
how to get the values using post from a multiple list form when more than one value is selected ?.. is it possible ?

Keeping Values In Form Inputs After Validation.
How do you put posted values back into form inputs if validation fails. I've tried this:

<input type='text' name='title' size='30' maxlength='70' value='<?php echo $_SERVER['title']; ?>' />

This causes '
' to appear in the input box though. I have no idea why.

I figure this is an easy question. I'm not the only one who doesn't want their users to have to fill in a whole new for because of one mistake and not be able to see the mistake.

Saving Off Form Values To Redisplay After Error Routine
I have a form with radio buttons that works to redisplay form values if an error is found:
<? switch ($Quest01)

{
case "A" ?>

<input type="Radio" name="Quest01" Value="A" Checked>
<input type="Radio" name="Quest01" Value="B">
one for C and D

There is a case also fo B,C,D

Is there another way to do this?

Display Values Of The Form Inside The Table On The New Page
I am generating data from database and displaying it inside input text boxes (for users to make some changes). What I need to do is when user presses "submit" button display all of the results inside the table on the new opened page. How can I do it?

Checkbox Array From Form - Shorthand For Looping The VALUES?
I am retreiving values from checkboxes in a form to decide where thumbnails and uploaded images get placed (same image goes in multiple directories). The following code works. But I wonder if there is a shorthand way to output the values in a while statment rather than a bunch of if statements. That is, is there a way to output ALL possible values (e.g., sports, group, 2002 - I have many others) in a loop? PHP Code:

Getting Values Into A Form: PHP (Server) Or Javascript (Client) Side?
This is sort of a weird question, perhaps a bit off-topic...

I am on the 'edit' screen of a web form, and I have a bunch of variables
coming from a database that need to be placed into the form. In the
past, I have been using PHP to pre-populate each field, something like

<input type="text" id="firstName" value="<?= $first_name ?>" />

But, since my "add" and "edit" screens are virtually the same, I'm
thinking about using PHP to dynamically create "onload" javascript
events that use a custom function... essentially something along the
lines of

onload = "setForm('firstName','<?= $first_name ?>');"

So, option one hard-codes the form-field value directly into the HTML.
Option two uses javascript to populate the fields.

This is a specific web application targeted to a finite audience who
will be using javascript-enabled browsers. At this point, I'm thinking
of going with the second option(javascript based), because I won't have
to scroll down to each form-field tag in my document and add the "value"
parameter (read: time saver).... the only drawback I can see is CPU Power
I guess... Or is that a ridiculous concern? What about using Javascript
to populate 100 fields?

Most importantly, do I need to worry about client-side interruptions that
can prevent the form from being populated (other than turning javascript
off)?

Double Quoted Values From Database Won't Show Up In Form
I enter user input from a form into a mysql database using addslashes. When I access values with a double quote from the database they won't show up in a text form field as the default value. I use stripslashes when accessing database values, magic_quotes_gpc is on, magic_quotes_runtime is off, magic_quotes_sybase is off.

Refill Failed Form Validation With Original Values
I have a form which takes values out of a database and fills the fields. What I would like to do is, if the form fails it's validation i.e. field was left blank, it's original values are placed back in the text boxes. Code:

Preparing Mutiple Values For Hidden Input To Form
I have a requirement to enter values in a form in the following format.

<input type="hidden" name="item_name_1" value="Item_name_1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="item_name_2" value="Item_name_2">
<input type="hidden" name="amount_2" value="2.00">

In my application the item name = $title and amount=$price
I have code which extracts the title and price but I cant figure out how increment the item_name_x and amount_x by 1, starting from 1, for each item purchased. Code:

Querying Mysql Database Based On Values From Html Form
I want to build a simple form for querying database having business organization info. The form has four fields name, category, city and state. Users should be able to search based on any of these fields. Code:


Copyright Đ 2005-08 www.BigResource.com, All rights reserved