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




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?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Form Verification Before Submitting
I am trying to verify a couple fields in a form before it gets submitted, I used javascript but it still submit the data to the database even after it gives
the warning message. Is there a better way to do that in php? I have a report_process.php that inserts the data into the database.

Server Side Form Verification
I am looking for a PHP script that makes a form verification.

The action of the form would be the same page in order to keep variables easy to get. Error message will be personalise for each form's object.

Posting To A Form With Image Verification With CURL
this code keeps posting the wrong image verification code, to the form, because when it loads the form again to post the code that I retrieved the image verification code, is now changed

How can I do this successfully with curl? If you have any experience with using curl functions in php you CAN help me on this one....

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?

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?

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:

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.

Form Fields Not Carrying Data
I'm having a problem with the following form; Code:

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?

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?

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?

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.

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?

Broken Upload Form With Images And Fields
It uploads the images, but not to the made directory called $name, and it inserts all SQL fine, just the upload to the specific directory isnt working? Code:

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.

Include Blank Form Fields When Emailed
I have at least 45 fields in my form and only 8 of them are required namely, NAME, GENDER, DATE OF BIRTH, AGE, HEIGHT, WEIGHT, EMAIL AND CONTACT NO. The rest is optional. The problem is, I dont want to include the blank fields which have not been filled up when the SUBMIT button is clicked. I just want the fields which has been filled up to appear in the mail recipient.

Sorting An Array Based On One Of Many Form Fields?
I think the root of my problem, aside from mental, is array based...but I'm not even sure what I want to do is even possible. So if I can get far enough to know that one way or the other, then I can try to figure out how to do it.

But here's the situation:

Page 1 I have a form with many item rows pulled from a database query. Among other fields, each row contains a checkbox to select the item and a text field which contains an item_description.

On submit, I have it so that every checked item goes onto the next page where more stuff happens to each item, and the select items end up in an HTML table as well as a CSV spreadsheet.

Now, because the selected items are pulled from an array based on the checkbox, the sort order is based on the item's unique ID number. WHat I'm being asked is if I can have the final results sorted by that item_description field I mentioned before. Which can occurr at the end of the 2nd page's processing, sure.

Well, here's what I have to select the items: .....

Getting Form Fields To Accept Images And Formatted Text
does anyone know of any applications available (or the coding) that can be used to insert formatted text or images into form fields rather than the plain text inputs that are allowed in HTML?

Dynamic Fill Form Fields Depending On Dropdown Box
This question has probably already been asked, but let me ask again

I have a mysql database to which I connect with my php scripts. The
database contains articles. Name, Unit_Price and Reference

Now my client needs to order 5 items, click a button and a table with 5
lines and 3 columns appears (until now easy)

In the first column is a drop down box with a <select > and <options> in
which I store all possible names.

I would like than whenever the client changes one of the boxes (in my
case there are 5) the Unite_Price column and Reference column in the
line he just choose get automatically updated

Submitting Multiple Form Fields In An Array / Loop
I have the following form

<FORM NAME="form1" METHOD="POST">
<?php do { ?>
<input name="approve[]" type="checkbox" id="approve[]" value="<?php echo
$row_rs['ID']; ?>">
<select name="select">
<option value="1">option 1</option>
<option value="2">option 2</option>
<option value="3">option 3</option>
</select>

<?php } while ($row_rs = mysql_fetch_assoc($rs)); ?>
</FORM>

I want to acheive a loop that inserts a record into a database that enters
the id and the value they have selected (if the approve input box was
ticked)

so far I have this:
<?
foreach($approve as $aID) {
$insertSQL = "INSERT INTO TABLE('refID','optionSelected') VALUES
('$aID','')";

}

?>

How do I enter the select value within this loop?
I assumed that it would be just
$insertSQL = "INSERT INTO TABLE('refID','optionSelected') VALUES
('$aID','$select')";


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