473,386 Members | 1,803 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.

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>
Jul 17 '05 #1
2 5298
I noticed that Message-ID:
<2c*************************@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/
Jul 17 '05 #2
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>
Jul 17 '05 #3

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

Similar topics

9
by: SB | last post by:
Ok, very simple problem. I'm trying to update a value by calling a function using pass by reference, but it does not update the value. In short, the value I'm trying to update is balance, which is...
17
by: LP | last post by:
Hello, Here's the scenario: Object A opens a Sql Db connection to execute number of SqlCommands. Then it needs to pass this connection to a constructor of object B which in turn executes more...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
39
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
17
by: Ashwin | last post by:
hi guys, i have overloaded the << operator.as shown below. ostream& operator<<(ostream &out, const student &a) { out<<a.idno; out<< " " ; // out<< a.name; out<< " " ; // out<< a.marks...
0
by: parekh | last post by:
Hi All , I am facing a problem wherein my VB project is not recognizing a change in the argument list of a method ( the method itself being declared and defined in another VC++ project and it...
1
by: User1014 | last post by:
Since you can pass a function to a ... erm...... function.... how to you use the result of a function as the argument for another function instead of passing the actual function to it. i.e. ...
35
by: Chris | last post by:
Hi, I tried to create a class which must change the propety 'visible' of a <linktag in the masterpage into 'false' when the user is logged. But i get the error: "Object reference not set to an...
11
by: venkatagmail | last post by:
I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.