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




PHP Form Submission Data Errors


One of my variables "link1" that is storing a bunch of urls is having random
lines being duplicated on form submission. I just recently swithed servers
from a PHP 4.3.3 to a 4.2.2 version. This error has only started appearing
on the new machine. The script worked fine on the old server and still does
on the test server. Any ideas? I think it might have to do with the ini
config. i am stumped. here is a link to my code.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Server-Side Form Submission - Form Submits To Form, Which Autosubmits. BAD!
I have a php form from which the user fills out their name and address and clicks "Submit".

The form goes to a page that stores the data in a mySQL database, then, using hidden fields, populates another form and actives with a javascript onLoad=submit() to send the information on to the final destination.

I cannot control or edit the final destinations web page, which is why the interim page is needed.

What I would like is for the user to fill out the form, and upon submission have the data recorded into the database and have the data passed on in a "form like way" on to the final destination BY THE SERVER, not by the use of a hidden form page that auto submits.

Any suggestions?

Here is the interim page's code below:

<?
$link = @mysql_connect($db_host_name, $db_name, $the_decoded_password) or die;
@mysql_select_db($db_name) or die;

$query = "INSERT INTO web_link VALUES ('', '$a', '$b', '$c','$d', '$e', '$f', '$g', '$h')";
$result = @mysql_query($query) or die;
?>
<html>
<head>
</head>
<body onLoad="document.contactme.submit();">
<form name="contactme" method="post" action="http://www.test.com/cgi/storethisdata" >
print "<input type="hidden" name="first_name" value="$first_name"><br>";
print "<input type="hidden" name="last_name" value="$last_name"><br>";
print "<input type="hidden" name="email" value="$email"><p>";
print "<input type="hidden" name="phone" value="$phone"><p>";
?>
</form>
</body>

</html>

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:

Form Self Submission
I have a form which I am trying to have submit to itself, but change 1 var so that it changes what is printed. how can i do this so it works? Code:

Form Submission
I print out the following after I submit a button. How can i print the following two buttons in the previous form which I'm submitting.Of course, these two buttons should appear only after the form is submitted. Code:

Form Submission
I have an event calendar. Users submit thier events and then I also allow them to edit thier entries. When they edit an event, that recorded is stored in a different table. I then go in and view the record. When I submit it, it updates the main table.

Below is the code for viewing the edited info. On some records the submit button doesn't work? I click on it and nothing happens? Why would this happen? PHP Code:

Form Submission
I am working on a PHP based web-site which is running a text based war game. So, there are lots of forms users need to submit. One of the form players submits is to ‘attack’ other player (not physically though). For that, player needs to fill out a form (let say this form is on the script1) having two or three input text fields.

After filling out the form user clicks on submit button which then calls (let say script 2) .This script 2 then does all the logic, modifies the database according to who won the attack , calls back the script 1 with the result to be shown to the player. But what is happening right now is that players are abusing the game by clicking the submit buttons or hitting (enter/return) key multiple times(very very quickly), although they are allowed to attack as many times as they want but not before the last attack is done means until they got the result of last attack.

They are clicking submit buttons before the last submission updates the database. Is there any way once the player submits the form, they cannot submit it again until the script 1(containing the form) gets reloaded again with the result. Also each script is a PHP Script. I hope I explained my problem. I heard there is way u can do it with JScript but what if they disable their Jscript.

Form Submission
On my three development boxes I run Gentoo, BSD and Windows with practically the same PHP config along with Apache 2. A project I recently completed was just uploaded to a client's server running Apache 2 and PHP (5.2.1). I can no longer submit any data from forms: Code:

Form Submission
I need help with this form submission, i understand for submission is the easiest thing to do in php. But i just can't get this to work.

Basically i have a form in which is a question. I have given users choice of 4 answers to this question in a dropdown menu. I just want the form to recognise what answer the user has chosen and put it into a table called support and the column 'category' in it. Code:

Form Value Submission Problems
I'm having a little problem with my php in that when I
submit a value with more than one word from a form, (for example,
"Cineworld Renfrew Street"), only the first word seems to get
submitted, so that when processing it after submission, only
"Cineworld" is available. Is there a way I should be formatting form
values to prevent this?

How Do I Stop A Form Submission
I have the below code. It has a member number input box. Once a member number is entered, it validates the number against a member number in a table. If the member number is a valid number, it will submit the form, if it is not a valid number it redirects the user to a signup page. But it is not working, it is submitting always. Code:

Submission Form To Fax Machine, Is It Possible?
I got quite a question here, is it possible that from a submission form on a website the results get faxed throught the webiste directly to a fax machine? I would really appreciate any insight on this concept. And where to start.

The Woes Of A PHP Form Submission
Good evening to the skilled Ladies and Gentlemen of the PHP world. I
am fairly new to all of this but learning quickly. I have run in to a
need to remove blank lines from a form submission after its sent back
to the web server for processing by a PHP document.

I have a textarea that users can paste lines of text in to and submit
them for inclusion in to a database. Every aspect is working
perfectly, except one. No matter what I try, I cannot get rid of
simple blank lines from the form submission.

$theLines = $HTTP_POST_VARS['userSubmitted'];

This variable ($theLines) now contains the contents from the textarea.
I have tried using ...

$theLines = explode("
", $theLines);

and

$theLines = explode("
", $theLines);

But all of the blank lines are still there. If anyone has some
snippet that they would share, I would be very grateful.



Disabling Enter Key For Form Submission
Could anyone please help me with tips on how to disable a ENTER key, so that a form is submitted only when the designated button for submission is clicked.

Display Of " And ' From Form Submission
I have single and double quotes in the text field which is submitted on one page. When I display this on the next page I see ' and " in place of ' and " respectively.

Bug In IE5+ Involving Form Submission & Images With '?' In URL
I have been experiencing problems with images containing query strings in their URLs. When I land on a page containing these images having submitted a form they don't appear. I heard this is an IE bug. Is there a quickish workaround using PHP? I tried processing the form(s) with an intermediate script, then redirecting to the destination page but still no images.

Disallowing Multiple Submission Of A Form
i have a dynamic form that sends data to a mysql table. it sends data into the table according to variables that are passed in. e.g. form.php?book_title=abc

how do i block the user from sending information about the same "book_title" more than once?

Updating Text In Form Submission
I am using a text area form submission to add imformation to a html webpage, and I would like to be able to edit that text in the php form at a later date after submission.
Does anyone know how to get the origonal text back into the form text area for editting and resubmission?

Trouble With Mailing A Form Submission
I recently had to move all my php pages and MySQL db to a new server and may have overlooked a setting or two in the php.ini or somewhere else. This form worked up until the move. Here's the code:

Form Submission And Include Files
I have an index page that I want to put an e-mail newsletter signup form on. I have the form inside another page called "misc.php" that is included in the index page. So far so good. When someone submits the form, though, which page do I send the POST to? When I send it to index.php the misc.php page seems to not get the variables.

And of course if I send it to itself it works fine, but it takes me to another page, which I don't want. This is very strange.

Capturing Results Of A Form Submission
Is it possible, in PHP, to capture the resulting HTML of a submitted
form returning from a server and incorporate that HTML into say a
table, or some predefined layout?

I am trying to incorporate the resulting HTML into a layout I have
created in order to keep the look & feel of my site consistent, but
the resulting page is a plain "cheesy" page.




Encrypt Form Variables During Submission?
I've been looking around the net for a solution (I'm pretty new to php) on how to encrypt a form variable before you submit it, is this possible?

To give you an idea, I have a "change your password" type form and when the user enters their new password and clicks submit the password is sent out in the open before it's encrypted (md5) and put into the database. I'd like to encrypt it BEFORE I send it though. I plan on using SSL but I'd also like to see if what I'm trying is even possible.

Coding A Form From Email Submission
I have a customer who wants his contact page customized to be a form with questions to be answered by the person trying to contact him. When they are done filling in the form it is suppose to be emailed to him. I can not get this form to work right. Code:

Prevent URL's In Form Submission
I need a way to prevent URL's from being inserted into form fields. I have not been able to discover how to do this. Our forms are being submitted with junk URL's in the form fields. I would like to either A) Kill the form processing if URL's are posted, or B) Provide a pop up message stating that URL submissions are not allowed.

Creating A Tag Cloud Submission Form
I have recently redesigned a clip dump script and I am trying to add the ability for people to submit tags for their items. Here is what I have done so far. Code:

Multiple Attachments In An Email Sent From Form Submission
Currently the user selects a document to download, fills in their details and hits submit. They get the file emailed to them, and I get an email telling me their details and which document they downloaded.

However, I'd like the user to be able to select multiple documents (using tick boxes maybe) to be emailed in one mail. There might be 5 documents up there eventually and they could download as many of them as they want.

Would anyone be able to take a nose at the code below and tell me how it might be adapted for multiple attachments? I was thinking maybe to loop the attachment section, but I don't know how to do it, or what variable to use to come out of the loop. Code:

A Mystery (how To Mimic Form Submission With Headers)
I have this simple html form with only one field and a
submit button which uses the POST method. It works
fine.

I have been trying to learn php headers and found that
one could do exactly the same thing using headers.
Using ieHTTPHeaders v 1.6 - agreat FREE utility - one
can see the headers being sent when the form is
submitted, and then the php script with headers is
written.

It has worked fine always but in this particular case
although the headers are sent correctly .. the form
field value for some reason is not accepted by the
server. I was wondering if there are variables
(predefined variables) that are required by the server
but not being included in the headers.

Has anyone come across a similar problem?
How could one mimic the browser 100% - including all
the browsers predefined / environment variables?

Form Submission (no Button) Using PHP+cURL+ Transfer Control To Other Site
I'm trying to send data using the POST method and also have control of the browser be turned over to the website that's receiving the POST data (note that this is NOT the same as sending the data via POST method and then redirecting to the website after). I need it to work exactly like hitting the submit button on an html form, and I need it to work from PHP. It needs to POST the data to the site and also let the other site have control at the same time.

I've tried a couple of methods using both cURL and an fsocket function, but it seems like in both cases that (1) the data gets sent to the other site first, (2) then my program gets a response back, (3) and then it redirects to the other site afterwards. The data gets sort of POSTed to the other site (I get a 200 response back, and I get info showing it was posted correctly), but since the other site does not get control, it seems to dump (not save) the posted data. Code:

Re-populating A Form If Errors
I am learning php. I have created a simple Web page with a form.
After receing the POST request, I do some error checking. In case of
errors, I would like to re-post the page, but with the current values
for each field.

I have organized my files like this:
1) Webpage with the form (all in html, form action points to a php
file)
2) php file that receives the request.

Thoughts On The Best Way Of Highlighting Form Input Errors?
I've been creating an application over the last few weeks and generally
pleased with what I have produced but one area is irritating me, form
validation.

At the moment the forms are simply static html templates and the form input
is checked using a validation class. Basically each form field is checked,
every error is stored to an array and at the end of checking of the complete
form, the array is output neatly at the top of the form.

However this is just not sexy enough for me, what I would like to happen is
for the input boxes with errors to be highlighted with a red border (or
something along those lines). I would also like to have the error messages
under the box which the error occured, not altogether at the top of the
page.

So I am currently wondering how to achieve this and what choices are open to
me on methods available? I've had a google around the web and found some
form validation classes but they basically do what I already achieved. I've
thought of creating the forms dynamically but that in itself doesn't address
how to achieve my goal.

I am sure many people have already successfully done this, if you have the
please could give me an outline (the theory) of how you did it. I don't want
or need code, I am simply stuck at the moment on how to approach this.

PHP Form Submission <input Type="hidden"> Security Issues?
Someone has said to me that when using a form (method = post), that storing data in "hidden" tags

ie <input type="hidden" name="myField" value="something">
means that the user can set the value to whatever they like

So my questions are:

1.  How would they do this
2.  How can I stop it
3.  Do I have to abandon the hidden values and go with sessions?

Validation Errors From Displaying On Form Page Load Instead Of Submit
creating two forms and they work fine. Problem is that the validation errors display immediately on page load instead of on submit. Here's the full code for the form parsing: 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:

Supress Errors At The Page Level? Undefined Index Errors.
I'm creating a simple reply form, and if a form item isn't answered I
get an error:
"Notice: Undefined index: rb_amntspent in
c:inetpubwwwrootmackinawsurvey.php on line 36"
even if in the code I allow for an unselected item. (Code at the
bottom here.)
It works fine otherwise.

Now in the past I've made a change to php.ini to repress errors, but
for this project I don't have access to the php.ini.
Is there a way to supress errors on that page for that session?

Or, is there a way to just not get that error at all?

Here's a sample of the code that gets the form response. If an item is
selected, no error for that question, but if an item is not selected I
get the error above even though I still get a successful echo for the
"else" or "default" option which occurs if nothing is selected:

$rb_visited = $_POST["rb_visited"]; //Have you ever visited Mackinaw
City, Michigan?
if ($rb_visited == "1") {
$rb_visited_reply = "Yes";
} elseif ($rb_visited == "0") {
$rb_visited_reply = "No";
} else {
$rb_visited_reply = "You did not answer this question";
};

$rb_lastvisit = $_POST["rb_lastvisit"]; //When was your last visit to
Mackinaw ity?
switch ($rb_lastvisit) {
case "1":
$rb_lastvisit_reply = "Earlier this year (2003)";
break;
case "2":
$rb_lastvisit_reply = "Last year (2002)";
break;
case "3":
$rb_lastvisit_reply = "2 years ago (2001)";
break;
case "4":
$rb_lastvisit_reply = "3 years ago (2000)";
break;
case "5":
$rb_lastvisit_reply = "4 or more years ago (1999)";
break;
default:
$rb_lastvisit_reply = "You did not answer this uestion";
}

Comparing Form Data To Mysql Data
Im interested in building a script that would take form data, a variable like an address, and compare it with a known address in a mysql table (called addresses), then if there is a match log the address information in a separate table called (addresslog), and return the visitor to a certain page. If there is no match between the address entered in the form and known addresses then the information is still logged into the addresslog database but the visitor will be sent to a different page.

I'm still new to this, and am working through the logic and the syntax, but I believe I'm close. It's still not working, I have all of the proper tables, maybe I'm way off with the coding so I thought I would seek out some expert advice. Here's the entire script with as much explanation as I could give. PHP Code:

Getting Data To Form
How to create when enter staff no, it will automatically generate out the name in the same form ?

Getting Data From Mysql To Put Into Form
i am trying to set up a page that will allow the user to select a name from a list. The details of this name(ie, last name,address, job etc) are then taken from a database and put into a form. If any changes are needed the user makes them then presses a submit to update the database.

I can get the information out of the database and into the form fields but i have one small problem...

In the address field i can only get the first part of the address...
ie

if the address is 123 Sample Street

only 123 gets put into the form field.

How do i get the rest of the address to appear?

i am sure it is quite simple but cant quite put my finger on the answer!

my code is:

Address: <input type="Text" name="address" value =<?php echo $myrow["address"] ?>><br>

where $myrow is the array holding the results from my database query.

Any help would be appreciated!

Post Data W/out Form
I want to post variables to a php script, but I do not want to use a form to do this... is there some sort of header I can use to redirect and post values to another page?

Cookies and sessions are not an option, URL line ('get') variables can't hold large enough a string...

How To Use GnUPG With Form Data
I am looking to encrypt form data that is submitted over an SSL and send that via email to my client. I understand some of the basic encryption processes, but could someone help me understand :

1. How to encrypt the data with GnUPG before it is emailed.
2. What does my client need to be able to decrypt the data?
3. My web host currently offers GnUPG so I can generate the keys - what do I do next?

I have done some searching here already but I could use some getting started help.

Reload Form Data
I am developing a web site using php. I have a form for login in page1, which has two input box and a submit button. When I click the submit button in page1, it runs page2. When I click BACK button(now in page1), and FORWARD button (supposed to be in page2). Both IE and Netscape give me a message like the following (note: the browser cache is not turned off either by php header() or by browser setting):
*********************************************
This document resulted from a POST operation and has expired from the cache. If you wish you can repost the form data to recreate the document by pressing the
reload button.
*********************************************

When I press the RELOAD button, page2 is load correctly. Now, how can let the browser automatically do the reload without showing me the above message?

Inserting Data Using A Form
I created a script to allow the user to select the number of images to enter. After that the script generates the entry fields dynamically. The final step is entering all images into one column in the db called images.
The problem is i got it to work using an advice from someone at devshed forums to use some additonal script. Please see below.

1) HTML File that allows you to enter the number of text boxes to create for each image you want.


<FORM METHOD="POST" ACTION="do_show.php">
<P><strong>Number of images:</strong><br>
<INPUT TYPE="text" NAME="num_imgs" SIZE=5></p>
<P><INPUT TYPE="submit" NAME="submit" VALUE="Go to Step 2"></p>
</FORM>

2) PHP file that shows the created text boxes for you to enter the names of these images:

Problem With Form Data.
I have a form that I need to be able to input html, such as < a href="blah">blah</ a> and store it in a database, but php automatically puts 's in front of quotations and apostrophys, is there anyway to prevent this from happening so when it is stored in the database it will be just as they typed it in the text field and not insert back slashes?


How To Save Form Data?
There is a button on one of my www pages which changes page content. It
adds some fields to the form, which is created by php script. After
changing the page is displayed once again. What I want to do is to save
form data so after changing and reloading the page field are filled.
That button is not Submit button. Can I do such thing?

Emailing Form Data
I have a form that writes to an MySQL database just fine but would
like to email people to give them a heads up that an entry was made
under their name (1 of 6 names on writing to the database). This
server exists on an intranet and would have no 'web' function other
than using possibly the existing email server.

Is all that I need to do to make this happen, to change php.ini as
follows:

[mail function]
; For Win32 only.
SMTP = mail.servername.com
smtp_port = 25

; For Win32 only.
;sendmail_from = whoever@servername.com

My input form is as follows:
<form action="process2.php" method="post">
From: <input type="text" name="from" size="20" maxlength="20" /><br />
To: <input type="text" name="to" size="30" maxlength="30" /><br />
Subject: <input type="text" name="subject" size="30" maxlength="30"
/><br />
Message:<textarea name="text" name="message" cols="50"
rows="10"></textarea><br />
<input type="submit" name="submit" value="Send" />
</form>

and passes data to process2.php as shown in form 1:
<?php
@extract($_POST);
$from = stripslashes($from);
$to = stripslashes($to);
$subject = stripslashes($subject);
$message = stripslashes($message);
mail('$to',$from,$subject,$message);
header("location:process.php");
?>

This worked through my testbed on my SMTP 'once' and only sort of,
once so I might be missing something. :-)

Parsing Form Data
Im using Reichard Heyes Form Processor with php3 for customers to attach multiple image files to email to me. This form uses a template to print the emailbut I cant get the email to print the original file name for example:

file1.......johns image.jpg
File2.....Marys image.jpg

Sounds easy and most likely is but Im stuffed if I can get it to print So far all I can get is the Temp file name.

Form Data Not Posting
I was reading the forums and have not found the answer and could use some help. I am a novice and am learning how to do this out of neccesity for my non-profit org. I have a database with incidents that we react to during emergencies. I want to be able to have the users call up the record via ID (that works), change the status and/or details and save update mysql. It is just not saving the data. PHP Code:

Processing Form Data
I've just built a form that enables users to pick a city from a pull down menu. On the processing page i want to assign the city picked to a variable. So lets say the name of the form is "city" and i want to assign the city picked to a variable.

$citychosen = ********

What do i use to get the chosen city there. I want to use the variable in the next part of the page which uses an SQL query to show info about the city chosen. So the SQL query would look like this Select * from table1 Where city=$citychosen .

Retrieving Form Data.
I have two scripts - common.php and edit.php. The working is that common.php contains a form that is used initially for registration and later used again so that registered users can edit their information. edit.php contains the connection to the db to update the form with the current users information. PHP Code:

Web Form Data To MySQL DB
I pulled this script off of an MySQL article from the MySQL website itself. I adjusted it to my needs and I could connect to the DB, it could find the proper table, but it doesn't enter the data into the database table. So I pulled the original script off in hand, created the DB and table it had listed and still the same problem... it can't connect. Here's the script: Code:

Redirect Form Data
I've had help creating a redirect script, and that has worked successfully for inserting information into MySQL and the redirecting the user to the desired page when they clicked on a common link. A problem that I encountered is my script does not pass variables from a form, and I'd like to find a way to include those variables and redirect with the POSTed variables. PHP Code:


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