472,127 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Passing data between php files

I have a form with two drop down boxes that are hard coded as in the
example below, and another drop down (pull down) box that is populated
as a result of a MySQL query. All appears to work as it should with
the exception that after choices have been made and the submit button
clicked, (to either enter the data into another database OR work
together in another query - I've tried both), the field that was
populated by the initial query does not pass it's data as the hard
coded fields do. In other words, the 'month' below passes user data
to $month in mmonth.php but the data in the queried cell 'person' does
not pass to $person in mmonth.php - can anyone tell me why is
that? TIA - appreciate all replies...
<form method="post" action="mmonth.php">
<input type="hidden" name="id" value="NULL">
<tr>
<td><b>Month:</b></td>
<td><select name="month">
<option value = "Jan">Jan</option>
<option value = "Feb">Feb</option>
<option value = "Mar">Mar</option>
<option value = "Apr">Apr</option>
<option value = "May">May</option> etc
</select>
</td>
</tr>
Oct 9 '05 #1
4 4002
cover wrote:
I have a form with two drop down boxes that are hard coded as in the
example below, and another drop down (pull down) box that is populated
as a result of a MySQL query. All appears to work as it should with
the exception that after choices have been made and the submit button
clicked, (to either enter the data into another database OR work
together in another query - I've tried both), the field that was
populated by the initial query does not pass it's data as the hard
coded fields do. In other words, the 'month' below passes user data
to $month in mmonth.php but the data in the queried cell 'person' does
not pass to $person in mmonth.php - can anyone tell me why is
that? TIA - appreciate all replies...
<form method="post" action="mmonth.php">
<input type="hidden" name="id" value="NULL">
<tr>
<td><b>Month:</b></td>
<td><select name="month">
<option value = "Jan">Jan</option>
<option value = "Feb">Feb</option>
<option value = "Mar">Mar</option>
<option value = "Apr">Apr</option>
<option value = "May">May</option> etc
</select>
</td>
</tr>


They only way the select box would pass the value to $month in
mmonth.php would be if register_globals were set to "on" - which is a
huge security hole.

Rather, you should have register_globals set to "off" (which it probably
is since you don't see the value passed) and you can find the value in
$_POST['month'].

And next time you might try posting to ONE or TWO newsgroups.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 9 '05 #2
On Sun, 09 Oct 2005 17:09:17 -0500, Jerry Stuckle
<js*******@attglobal.net> wrote:
They only way the select box would pass the value to $month in
mmonth.php would be if register_globals were set to "on" - which is a
huge security hole.

Rather, you should have register_globals set to "off" (which it probably
is since you don't see the value passed) and you can find the value in
$_POST['month'].


Thanks, using $_POST['month'] and $_POST['person'], does indeed pass
the values for 'month', just not 'person'. It reads 'person' just
fine to populate the first query but wont pass the newly populated
drop down value anywhere else in spite of using $_POST['person'] on
that page. There must be some way to retain the value of 'person' and
pass it as much as you like between pages.
Oct 11 '05 #3
cover said the following on 11/10/2005 10:15:
On Sun, 09 Oct 2005 17:09:17 -0500, Jerry Stuckle
<js*******@attglobal.net> wrote:

They only way the select box would pass the value to $month in
mmonth.php would be if register_globals were set to "on" - which is a
huge security hole.

Rather, you should have register_globals set to "off" (which it probably
is since you don't see the value passed) and you can find the value in
$_POST['month'].

Thanks, using $_POST['month'] and $_POST['person'], does indeed pass
the values for 'month', just not 'person'. It reads 'person' just
fine to populate the first query but wont pass the newly populated
drop down value anywhere else in spite of using $_POST['person'] on
that page. There must be some way to retain the value of 'person' and
pass it as much as you like between pages.


The fact that the HTML for the "person" choice was originally
dynamically generated will have *no* bearing on whether GET/POST
variables are being recieved, unless it was dynamically generating
*incorrect* HTML.

Check the HTML source in your browser, and make sure the generated code
is correct.
Note: F'up to alt.php.sql removed.
--
Oli
Oct 11 '05 #4
cover wrote:

Thanks, using $_POST['month'] and $_POST['person'], does indeed pass
the values for 'month', just not 'person'. It reads 'person' just
fine to populate the first query but wont pass the newly populated
drop down value anywhere else in spite of using $_POST['person'] on
that page. There must be some way to retain the value of 'person' and
pass it as much as you like between pages.


OK, but since you didn't post the failing code, it's impossible to tell
what's going on.

Try posting the entire contents of your form.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 11 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Paul | last post: by
14 posts views Thread by Antoni | last post: by
2 posts views Thread by Hakan Örnek | last post: by
4 posts views Thread by sofeng | last post: by
3 posts views Thread by iu2 | last post: by

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.