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




Form Fields Not Carrying Data


I'm having a problem with the following form; Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Avioding Expired Pages, & Carrying Data Accross Multiple Form Pages
I have a checkout/order form that consists of 6 pages, all PHP. The are linked to one another, like, after the user finishes page 1, they proceed to page 2, etc... The first two pages are submitted by a GET link, so those are not in my question. The next 4 are submitted using a <form>. Throughout all of the pages, i would probably have about 25-30 variables, things that the user has to fill out. I have two questions,

1. What would be the best way for me to keep track of all the data moving throughout the pages, like storing it from page 4, and i still need to access it on page 6.
2. I don't know if anyone could help me here, but does anyone know of a way to code around those ugly "page expired" pages, because of a submitted form. If a user needs to go back, which most likely they will, is there some sort of way for me to skip the expired page?

Defaulting Data In Form Fields
in a lengthly form, is it possible to use PHP3 to automatically fill form fields with data that has already been entered into a previous place on the same form?...or from a previously filled out form?..likewise, is it possible to perform a math calculation on a number entered into a field and have the result automatically defaulted to another subsequent field?

Enter Data Into PDF Form Fields
Is it possible to use PHP to fill in fields in a PDF form? The form can be found at :PDF form The background to the question is that I have a client who has a debt collection database system written in DataEase that ouputs County Court Summons data on to Court Summons Stationary. This is hit and miss on the printing margins depending on OS system or printer.

The system is being written in PHP so the summons forms could be produced in HTML if the existing PDF form isn't a viable solution.

Reading Form Data In Fields Are Unknown
I have a project where the users can modify their forms and thus their form field names. Is it possible to simply read what is passed through the headers without knowing the names of the fields.

Carrying Over Variables From A Form To Multiple Pages...
I have some data from text fields that are being passed over through a
form that I am displaying with the $_POST superglobal. Once i have
echo'd out this data onto the next page, i'd like to continue to use
it on the next page. I haven't figured out how to do this properly
just yet, but I'm guessing it has something to do with sessions. I
have MANY variables being passed (over 100) and I'm hoping i don't
have to register each one of these manually with $_SESSION[].

example.

//first page (index.html)

<form action="form.php" method="post">
<select name="color"><option value="blue">blue</option><option
value="red">red</option>
<input name="submit" type="submit">

//new page (form.php)
<?php
echo "Bill's favorite color is {$_POST['color']}";
?>
////

Now say I want to use this $_POST['color'] value on another page that
the form.php takes you to next.....how do i continue to use this value
across multiple pages?

I'm assuming this is a trivial question, but i can't seem to figure it
out!

Dynamic Form Fields/multiple Page Form?
It is for a friends out of print booksite, where visitors can request multiple books to be searched by adding one at a time to a cart (javascript), then once all added they submit to another form where they enter their personal details and all is sent through. The problem is at the moment they cannot change whats in the cart without refreshing the browser window and losing everything.

1) present for asking how many books they want to search for
2) display multiple rows of the same input fields depending on how many books they say they want to have searched for?i.e

title|author|publisher|etc
title|author|publisher|etc
title|author|publisher|etc

3) when these are submitted they could see these above the next part of the form where they enter their details with the option to go back and delete/amend.
4) send all the info to my colleague.

if so has anyone seen a similar script that I could take a look @ to see if I can hack it to suit my needs?

Testing If Two Fields Have Data In Them
Im trying to test if two fields have been entered at the same time
I have tried many combinations but cant get it. My last effort was

if(isset($_POST['Link'] && isset($_POST['uploadedfile'])){
die('You can't select to upload a link and a file at the same time.');
}
else
{
STUFF HERE;
}

but still cant get it to work.

Combining Data From Two Fields, Displaying With Another Table
What I am trying to do is pull data from two tables and display it on one page. The code below doesn't display any errors, but all it prints is the results from the first query. Ideas? Thanks.

(I also need to somehow put a variable in for the warranty table data so it is tied to the product_status table data. You can see there is a WHERE in the first query of pid, but no WHERE in the second query. That is a seperate question, though. It would make this way too long, so I will post it separately). PHP Code:

PHP Script To Sort Data/create Pages According To Fields?
Someone fills out 3 fields. (There will be more but this is just to
give you an idea)

1. Country
2. State
3. City

I want this script to generate a web page and list the people by
information submitted.

eg. Everyone that put in USA will be listed on a page.

or

Choose California and everyone that typed in California will be listed
on a page.

I can also create links with criteria at the end. eg.
mysite/search.php?=montana

This script will also accept data from people. So people will visit,
type of the form and if the information is valid (not spam) then
they'll be in a database and able to be sorted.

Looking For A PHP Script To Sort Data/create Pages According To Fields.
eg.

Someone fills out 3 fields. (There will be more but this is just to
give you an idea)

1. Country?
2. State?
3. City

I want this script to generate a web page and list the people by
information submitted.

eg. Everyone that put in USA will be listed on a page.

or

Choose California and everyone that typed in California will be listed
on a page.

I could also create a link with the search term at the end. eg.
mysite/phpsearch=?montana

This script will also accept data from people. So people will visit,
type on the form and if the information is valid (not spam) then
they'll be in a database and able to be sorted.

Redundant Data Display Based On Multi-value Fields
I have a website where I want to send an email out to a bunch of users of all the new content posted that day. My content is tagged in different genres or groups. A piece of content can have multiple tags. So an example would be that my content is called "Video Program A" and it has been tagged in the vocabulary "Genre" as "Horror" and also as "Narrative". So in my email, if a piece of content has been tagged more than once, all the other fields get printed out multiple times, too. How can I make it so that even if the there are multiple termname and vocabname data, the rest of the data (title, description) only gets printed out once? Code:

How To Populate Data Into Text Fields On Page Load??
I am creating an account management page that shows the user's contact information and I would like to populate the textfields so that the user doesn't have to type in all his information when he wants to change something.  I want to have him type in only the information he wants to change or update. 

I already have the data displayed on the page. But now I would like to take the data and fill in the textfields with it.

Process Form Fields
Hi, I need to process a generic html-form. Is there any way to access to the form elemts as an array?

Trying To Duplicate Form Fields.
What I would like is to when someone writes in one field. The same text is written in a seperate field. But without sending anything. all internally. Anyone have a clue?

Form Validation- One Of Three Fields
I've been looking for a PHP script to accept a search form for either the name or town or postcode fields to search a MySQL db. I would like the user to put in any one search field but not none.

Also I am trying to figure out a select statment to select one item on a drop down form list or any item on the list eg the list would be dog, cat, horse, fish or all, the column would be pets. The search would pull out any single pet or all pets.

Fill In Form Fields On PDF
Looking for classes or libraries which allow you to fill in form
fields on a PDF document.

Populate In To The Form Fields
i worked on some programs that gets the datas from the user and insert them in to the database.now i want to retrieve the data from the database
and i want them to populate in to the form fields.

Parse PDF Form Fields In PHP
I am trying to find out if it is possible to open a pdf file from
within PHP, and parse its contents in order to extract all form
fieldnames that might have been previously setup within the pdf
itself.

I want to find this out so that I can then generate a HTML form with
all required questions, which when submitted, will generate a fdf /
xfdf file, using the techniques from the following tutorial
http://koivi.com/fill-pdf-form-fields/tutorial.php

Posting Form Fields
I have a form like the one below. Upon submit I would like to self post
to the same page but have the original $_POST data( which was posted to
this page from another ) also be sent along with the new form field
data. How can I achieve that? Thanks.

<form name="form1" method="post" action="<?php echo
$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>">
<table>
<tr>
<th><input type="text" name="fields[]"</th>
....
<th><input type="text" name="fields[]"</th>
<th><input type="submit" value="Add" name="add"</th>
</tr>
</table>
</form>

Empty Form Fields
I have a simple HTML form, which when submitted I want to check whether he fields have been completed. If everything is complete, I want to process the form....No problem with this bit.

If any of the fields are not complete however, I want to indicate this......for example by placing a * character next to the field which is empty i.e.

echo "<TR><TD>Username</TD><TD><INPUT TYPE=text NAME=username></TD><TD>*</TD></TR>";

I am guessing that the best way to do this is submit the page to its self, and check for any empty fields, then display the form again. What would be an efficient way of doing this, given that I have to check about 20 fields?

Form Fields And Verification.
suggestions to with keeping data entered into form fields in place after verification fails and the user is requested to re-enter some missing data. Is there a smooth way to do this with PHP and forms, or would it be best to try and use javascript for a form, so when the "back" button is hit the data is remembered?

Hidden Form Fields
i want to output the value of the "hidden form field". When I hit submit, the the value is put to the hidden form field. when I hit the submitbutton a second time the value of the hidden field is dispalyed. Is there a way to display the value on the first submit
Code:

Getting HTML Form Fields
I'm trying to figure out a way to get the values of input fields from a HTML form, and place them in a database. For example if a html form had 3 text boxes one for "name" one for "email" and one for "url" how would I go about getting those values? I also need it to grab the values from hidden form fields, is there such a function or class?

I know it will prob have to entail some regular expressions, but as I'm not too familiar with regxep could someone take a stab at it? Also any good tutorials on regexep would be nice too.

Validating Form Fields
I would like to create a php script that can validate all of the required elements in the form. I'm not sure the best way to do this, but I know it's a smart idea to have good validation in place before there is a problem.

There are a few pages involved here, and the ACTION tag in the form is sending it to an email delivery script, so it needs to be as error free as possible. In this case would it be smarter to create inlined code that will validate the fields based on an if/else statement before the form is posted?

If someone could give me a sample code of what a simple form field validation would look like that would be great. PHP Code:

Add Fields To A Form Dynamically On The Fly
I'm looking to create a form the allows the user to input a simple list item by item. However I am not sure how to implement a form that allows the user to add as many fields as the need on the fly.

Dynamic Form Fields
I want to have it setup so when the user clicks this link a value is sent via get and that value is put through a for loop to generate an additional form field: Code:

Posting Form Data And Also Allow To Download Form Data
i have a client that whats to post form data to a database but he also wants users of the script to download it aswell how will i got about doing this i thought about it that i could make it save it into a txt file then echo the download link is there any ideas? because to post it to a txt file it would be posting 2 places is there a way to do this? Code:

Want To Autopopulate Form Fields From Database
I have a working form that submits info into a database.

I want to take a few fields about the poster (name, email) and hide them and have them filled out from my user table, which is the same database but different table then where the form data is being sumbitted.

I must be searching for thr wrong thing cause i am not finding any information on it.

POST Blanks Out Form Fields
I have a form that POSTs to itself and validates data entered into the form.
If all is well the form performs a header location command to move to the
next input form in the series. If the user has entered an error within the
form the user is NOT redirected to the next page and error messages are
displayed indicating the fields that are in error. So far so good. The only
problem is that all the input fields are now blanked out after the post.
These fields must display all the values that were inputted before the post
was executed.

I have tried the following to no avail......

reassigning values like this after the post => $zip=$_POST['zip'];

reassigning values like this after the post =>
$fullname=$_SESSION['fullname'];

Utilizing this Meta Tag => <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="CACHE">

How can I keep the data that was entered into the form fields before the
post was executed?

Form Fields Not Submitted In Php. Any Gurus?
None of the variables passed thru the HTML files once filled are displayed in the process.php

I checked my PHP.ini file it says register_globals=On ....

Hey Need Help With PHPMailer And Checkbox Form Fields
I need to be able to send an attachment for each checkbox the user
checks. like this: <input type="checkbox" name="file" value="bob.amr">
I need to have multiple checkboxes! and if they are checked the user
gets an attachment for each? I am using the popular PHPMailer!

How Could I Get The Form Fields Filled From A Database?
One idea I have is to do a redirect, but it doesn't quite
work because it ends to an infinite loop cause the page
is redirecting to itself:

header("Location: " . $_SERVER['PHP_SELF'] .
"?field1=something&field2=something else");

That would bee neet. I just would create a string from the contents
I receive from the db and just redirect, but as I said, it doesn't
work easily. You have to use the apache rewrite, but I didn't quite
get it.

Another solution is to check if the request is not empty for the
particular field.

Spell Form Fields Using Google API?
has anyone produced spell checker code for forms fields that uses the google
API?

WHat about any GNU spell check that does NOT use aspell/pspell/ispell?

Duplicate Input In 2 Form Fields
Hope to check the input in two form fields:

input in "emailto" form field: a@a.com
input in "emailfrom" form field: a@a.com, b@b.com, c@c.com

I hope to remove the duplicated input "b@b.com" in "emailfrom" form output and then keep only the remaining part of the string. How can I do that? I have though a way in combining the two fields input as an array and then use "array_unique" to check the duplicate. And then, to separate the two fields input again.

Having Dependant Form Fields (comboboxes) From Each Other?
I am currently programming on a form with 2 combo-boxes for input. But I need the box 2 output be dependand on box 1 input. I will explain in more detail: I have a SQL table that has 3 columns. One for type, second for motor and third for defining.

By PHP I have output all types (cars and bikes) in the first combobox.
Now what I need is, how can I manage, that when a person chooses e.g. in box1 Mercedes (which is defined in the 3rd sql column as a car) it would only show in the combo-box 2 of my form those motors that fit a car WITHOUT reloading?

I kinda simplified things here a little, but what I described above is the main problem I have. Somehow it must be possible through javascript I guess to check the value in combobox1 get the 3rd columns value of the mySQL table probably by PHP before, and then check IF that value is car then show only certain motors and IF that value is bike show other motors.

Checking For Required Form Fields
i have written the script to check for blank form fields (all fields are required)
on my registration form using :

if (ereg(".", $first) == 1){
$verify = "OK";}
else{
print ("<b>ERROR:</b> A first name is required.");
$verify = "bad";}

my question is, although this script works to verify a form field, it doesnt prevent the incomplete form from being sent to the database. can someone tell me how to stop the form from being sent if it is incomplete, and should this script be included on the form page(html page) or the php page that submits the data to mysql?

Omitting Form Fields If Empty
I have a form I'm putting together. The processing will be on a PHP
script that will take all the field names and print them out on the
email it sends to me. No problem there. But what I'd like to do is have
it exclude printing the field name and value when there are any blank
values in the field.

The processing part of the script is this:

if (is_array($val)) {
for ($z=0;$z<count($val);$z++) {
$content .= "$key: $val[$z]
";
}
} else {
$content .= "$key: $val
";
}

How would I adapt this to not print a field name with a blank value?

Sticky Form With Multiple Fields
how do i create a sticky form with multiple fields? say
i want a form with:

name: [input field name]
address: [input field address]
country: [input field country]

[submit button]

and if a user presses the submit button it will show
exactly the same page with the fields that the user
has entered filled in with the values (s)he entered
(validation of the values will come later), and the
info of the form sent.

should i name all the values in the form separately
or should i use an array?

Passing Hidden Fields In A Form?
I'm wanting to take information that is put into a hidden field by a sql query and post it to a script...I have a page that lists the players(nfl), in a table, for each persons team. beside their players name on their roster is a dropdown menu that has starter and bench. these options both have values.

then i also have hidden fields with the players names. what i want to do is be able to apply whatever option is selected in the table to the hidden fields so they can be passed to the script. if anyone has any better ideas i'm open.

Form Fields To Update A Webpage
I am trying to build this mini "publishing" system and allows the user to use form fields to update a webpage (images and text) then press a button to email that webpage to a list of emails. (spamming own userbase). I will have a webpage with php code in it and the code will pull data from the db.

How can I save the file has a static html file so that I can pass it to my mail function? or can I directly pass the php page to the mail function? or what is the best way of doing this? I also have to learn how to do file upload with php aswell.

Populating Form Fields With Variables
The script itself works fine: mail gets sent. If there are any missing fields the form displays again with a list of the missing fields, but I can't get the form fields of the reloaded form to be populated with teh existing values. PHP Code:

Check For Empty Form Fields
I am just starting with php (like 2 days now) and was wondering what was the best way to check for empty form fields. The code I am currently using is below but I was wondering if there was a better way to do it.

Also I would like to know if my code structure/layout is ok as it is important to me to get off on the right foot. PHP Code:

Identifying Dynamic Form Fields
User goes to page which is a form that asks for some basic info regarding returning products for credit/exchange, and also asks for how many products are going to be returned. Upon submitting, a return authorization form is presented to them with the specified number of product fields. I now want to take the input from this form and email it to myself, as well as, display a confirmation page to the user. The problem I have is a can't say, for instance, echo "$field_name"; because field_name will get created dynamically after the user specifies how many products to return. For example, say the user says 5 products, this will generate a form with field names like:

return_code0 inv_num0 qty0 product0 cre_exch0 stockout0
return_code1 inv_num1 qty1 product1 cre_exch1 stockout1
return_code2 inv_num2 qty2 product2 cre_exch2 stockout2 and so on....

These get created with a for() loop. Once this form is submitted, how can I address the field names? Code:

How To Validate Contact Form Fields?
I was just wondering how to make my contact form recognize if the user has actually entered any information into the fields. Right now if the user just clicks submit then an email will be sent to me without them having to enter any info into the fields.. Please can someone tell me how to prevent this? I would also like to know how I can filter the message field from letting the user enter in profanity? Code:

Form, Posting Multiple Fields
I have a product list page, users can check the product then go to an e-mail form, that lists the products they checked.

On this, they can then chose a quantity for every product, how do I make it so when they send the e-mail, it gets the quantity for each product (using PHP mail, to send)?

The field would be:
<input type="text" size="4" maxlength="4" value="1" name="quantity">

But that wouldn't work for multiple ones? Would I use a "foreach" statement, somehow?

Eregi Validate Some Form Fields.
I'm working with eregi to validate some form fields

I dont understand what this stuff means. "eregi('^[a-z]{2,30}$', $name)"

Can someone break this stuff down "^[a-z]{2,30}$" so I can understand it.

Losing Posted Form Fields Over Https
This has been driving me nuts. I have an application running for several
clients. Some run on http and two run on https. Two weeks ago, the https
customers started occassionally getting kicked out to the home page. This
is not every time, it's generally 1 in 10 form posts. Refreshing the page
asks you to repost the info and it posts as it should have in the first
place. Dumping the $_SERVER variable shows me that if things go well I get
the $_POST and $_GET variables and the $_SERVER["CONTENT_LENGTH"] is a
number. When the error shows up, CONTENT_LENGTH=0 and there are no $_POST
or $_GET variables.

I can only reproduce this over https on Linux/Apache/PHP using Internet
Explorer. I cannot reproduce it using Mozilla or Opera as a browser. And I
also can't reproduce it using IE over https with Windows/IIS/PHP. None of
the PHP code changed and there were no new installations on the server I can
point to as a possible cause.

We were running PHP v4.1.1 and upgraded to v4.3.4. I have been able to trap
the condition to offer our users a page to inform them to refresh so they
won't lose their data.

Any suggestions, ideas, places to look or ask more questions, is much
appreciated.

$_SERVER[SERVER_SOFTWARE] => Apache/1.3.20 Sun Cobalt (Unix) mod_ssl/2.8.4
OpenSSL/0.9.6b PHP/4.3.4 mod_auth_pam_external/0.1 FrontPage/4.0.4.3
mod_perl/1.25

Mail Function & Multiple Form Fields
I'm having some problems with a php mail form where I am wanting to
send information from 10 form fields in a e-mail. the way I have it
structured for the mail command is

mail ($to,$subject,$message);

where message is made up from the multiple fields from the form e.g

$message = "Name: ".$strName."
";
"Company: ".$strCompany."
";

The e-mail is sent fine but it only gives me the persons name and not
the extra fields.

Can anyone point me in the right direction?

Best Way To Create Object From A Form With Lots Of Fields
I have multiple forms that will create an object. Basically a energy
efficiency measure object. The measure object will have a couple of
required properties set but after that it can have 10-20 different fields
that are optional per measure.

How do I account for the different fields that will be
posted from the different forms when I create the measure object? Should
I create a constructor method with just the required fields as the
parameters and then create some sort of setter method for the optional
fields? Or do I create a different concrete measure object from an an
abstract measure base class? I have about 10 different measure objects
that I can think of but really the only difference between them are what
optional fields are posted.

Going forward the other issue is I need these measures to persist across
the pages of the application (sort of like a shopping cart app) and I see
that I can serialize an object in a $_SESSION object but do the fields
that I would set in the setter method also get serialized or do only the
actual properties of the object get set.

I then need to retrieve all these measure objects and send them to a
stored procedure to enter into a database so unfortunately I can't save
the fields as serialized because each field has to be separate to be sent
as the parameters to the stored procedure.

Basically my question is how do people deal with huge forms and fields
easily from a html post?


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