problem passing argument from one php page to another ...

This is a discussion on problem passing argument from one php page to another ... within the PHP Language forums, part of the PHP Programming Forums category; Hi, I am using creating a drop down menu populated by a call to a postgresql database. The drop down ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-05-2004
Newbie
 
Posts: n/a
Default problem passing argument from one php page to another ...

Hi, I am using creating a drop down menu populated by a call to a
postgresql
database. The drop down menu is populated correctly (or appears to
be) and then upon selecting an item in the menu it is supposed to pass
the argument indicated by the menu selection to another php file which
uses that argument to make a further (refined) search on the same
database.

But upon calling the 2nd php file when I try to use the argument
passed it appears to have no value, for example echo $argument; does
not yield the value passed.

I have included both php files below. Any help would be greatly
appreciated.

1st file:
--------------------------
<html>
<body>
<?php
$connection = pg_connect("dbname=hockey1 user=rhaynes host=emma");
if (!$connection) {
print("Connection Failed.");
exit;
}

$query = "select distinct year from tradelist order by year";

$myresult = pg_exec($connection,$query);
$num_rows = pg_numrows($myresult);

if ($num_rows == 0) {
print("No records exist");
}
else {
print("<FORM METHOD=GET
ACTION=\"http://emma/rhaynes/hockey_table4.php\">");
print("Choose a year from which to search ...<br><br>");
print("<select NAME=\"year_to_search\">");

while ($row = pg_fetch_array($myresult))
{
$id = $row["year"];
print("<option VALUE = \"$id\"> $id");
}
}
print("</select>");
print("<input TYPE=\"SUBMIT\" VALUE=\"VIEW SETS\>");
print("<input TYPE=\"RESET\" VALUE=\"RESET\">");
print("</form>");
?>
</body>
</html>
------------------------
2nd file:
---------------------------------------------
<html>
<body>


<?php
echo $year_to_search;
$connection = pg_connect("dbname=hockey1 user=rhaynes host=emma");
if (!$connection) {
print("Connection Failed.");
exit;
}

$query = "select * from tradelist where year ~* '$year_to_search'";
echo $query;
$myresult = pg_exec($connection,$query);
print("
<table border=10>
<tr>
<td> Year </td> <th colspan = 2>Card Description </th>
<td>#</td> <td>Name </td>

<td> Condition </td> <td> Quantity </td> <td> Book Value </td>
</tr>");
for ($lt = 0; $lt < pg_numrows($myresult); $lt++) {
$year = pg_result($myresult, $lt,0);
$manu = pg_result($myresult,$lt,1);
$set = pg_result($myresult,$lt,2);
$card_number = pg_result($myresult,$lt,3);
$player = pg_result($myresult,$lt,4);
$condition = pg_result($myresult,$lt,5);
$quantity = pg_result($myresult,$lt,6);
$value = pg_result($myresult,$lt,7);
print("
<tr>
<td>$year</td> <td>$manu</td> <td>$set</td> <td>$card_number</td>
<td>$player</td> <td> $condition </td> <td> $quantity </td>
<td>$value</td>

</tr>
");
}
print("</table>");

?>
<a href ="http://emma/rhaynes/hockey_table4.php">Search Again</a>
</body>
</html>
Reply With Quote
  #2 (permalink)  
Old 06-05-2004
Geoff Berrow
 
Posts: n/a
Default Re: problem passing argument from one php page to another ...

I noticed that Message-ID:
<2cb19dd6.0406051106.3201cdc@posting.google.com> from Newbie contained
the following:

>echo $year_to_search;


Try
echo $_GET['year_to_search'];

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Reply With Quote
  #3 (permalink)  
Old 06-10-2004
Michael Austin
 
Posts: n/a
Default Re: problem passing argument from one php page to another ...

looks like this has been solved... When posting in a NG, if you can cut
the example down to a few lines to demonstrate the problem it will much
easier for those of us trying to help.. it may also help you learn some
valuable troubleshooting techniques that you will need if you continue
in the IT business.

and... no I haven't spent a lot of time answering questions here, -
mostly lurking - but I have been a ng reader/poster since before it was
the WWW.

M.

Newbie wrote:
> Hi, I am using creating a drop down menu populated by a call to a
> postgresql
> database. The drop down menu is populated correctly (or appears to
> be) and then upon selecting an item in the menu it is supposed to pass
> the argument indicated by the menu selection to another php file which
> uses that argument to make a further (refined) search on the same
> database.


<snipped>
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:36 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0