473,386 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

2 Forms

I was handed a voting form that the company has used in previous years,
for updating. The first page is a form, asking for name, business name,
title and email address(twice for verification). The form gets posted
to a verfication PHP script that checks that the email addresses match
and that the email address isn't already in the database. If there is a
problem, it sends you back to the first form; if everything is okay it
sends you on to the second form.

The second form is the actual voting form. At the top of the screen,
the customer's information is displayed for them, using PHP variables.
So that name, business name, and title are at the top. Customer fills
out the form and clicks submit. The form forwards to a PHP script for
inserting the data into MySQL. This is where the problem comes in.
Everything but the name, title and email address gets written to the
database. I have checked my SQL query and it is find. My working theory
right now is that the second form erases all variables from the first
form, as for as the system is concerned. Here is a line of code from
the second form:

<form method="POST" action="check.php?email=<?php echo $email ?>">

It looks like the origional program was passing email in the URL which
would explain why email works but the name, business name and title
don't. I think the origional coder knew the issue. I am looking for
confirmation of my belief that only one set of variables can exist at a
time, from a form for any given method. If that is true, how do I pass
multiple variables in the URL above? I tried seperating them with
commas or ?.

Dec 6 '06 #1
3 1349

Jerim79 wrote:
I was handed a voting form that the company has used in previous years,
for updating. The first page is a form, asking for name, business name,
title and email address(twice for verification). The form gets posted
to a verfication PHP script that checks that the email addresses match
and that the email address isn't already in the database. If there is a
problem, it sends you back to the first form; if everything is okay it
sends you on to the second form.

The second form is the actual voting form. At the top of the screen,
the customer's information is displayed for them, using PHP variables.
So that name, business name, and title are at the top. Customer fills
out the form and clicks submit. The form forwards to a PHP script for
inserting the data into MySQL. This is where the problem comes in.
Everything but the name, title and email address gets written to the
database. I have checked my SQL query and it is find. My working theory
right now is that the second form erases all variables from the first
form, as for as the system is concerned. Here is a line of code from
the second form:

<form method="POST" action="check.php?email=<?php echo $email ?>">

It looks like the origional program was passing email in the URL which
would explain why email works but the name, business name and title
don't. I think the origional coder knew the issue. I am looking for
confirmation of my belief that only one set of variables can exist at a
time, from a form for any given method. If that is true, how do I pass
multiple variables in the URL above? I tried seperating them with
commas or ?.
I was able to find that the & symbol is the seperator between multiple
variables. It is working now. I still haven't found confirmation that
only one set of POST or GET variables can exist at one time. If this is
true, I wonder how the problem is handled at larger companies where
multiple POST forms could make up a site. Certainly they don't resort
to URL GET as I could see how the strings could be quite long in some
cases.

Dec 6 '06 #2
Jerim79 wrote:
My working theory
right now is that the second form erases all variables from the first
form, as for as the system is concerned.
Indeed, this is the case. A form submission is a *one-time-only*
action. Whatever form fields exist are passed to the next page,
afterwhich they no longer exist. Submitting that second form passes on
the second form's data, but none of the first.
<form method="POST" action="check.php?email=<?php echo $email ?>">
Eww. This just looks like a bad idea. Typically, to have forms span
multiple submissions, you need to propogate the form fields, but not
like this. The easiest way is to use hidden form fields. IE, something
like:
<input type="hidden" name="name" value="<?php echo $_POST['name'] ?>">

You give each piece of data you want to propogate it's own hidden
element, that way this data gets included along with the next form
submission.

Dec 6 '06 #3

Moot wrote:
Jerim79 wrote:
My working theory
right now is that the second form erases all variables from the first
form, as for as the system is concerned.

Indeed, this is the case. A form submission is a *one-time-only*
action. Whatever form fields exist are passed to the next page,
afterwhich they no longer exist. Submitting that second form passes on
the second form's data, but none of the first.
<form method="POST" action="check.php?email=<?php echo $email ?>">

Eww. This just looks like a bad idea. Typically, to have forms span
multiple submissions, you need to propogate the form fields, but not
like this. The easiest way is to use hidden form fields. IE, something
like:
<input type="hidden" name="name" value="<?php echo $_POST['name'] ?>">

You give each piece of data you want to propogate it's own hidden
element, that way this data gets included along with the next form
submission.
Thank you. I had thought about hidden buttons, but wasn't sure if that
was the way to go. I will go back and do it the way you suggested.

Dec 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
13
by: MD | last post by:
I have been converting a program from VB6 to VB.Net and enhancing it as well. All has been progressing OK although its been hard work. Now, all of a sudden, when I try to execute a ShowDialog()...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
6
by: dbuchanan | last post by:
I have a Windows Forms application that accesses SQL Server 2k from a small local network. The application has been used for weeks on other systmes but a new install on a new machine retruns...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.