473,757 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("dbn ame=hockey1 user=rhaynes host=emma");
if (!$connection) {
print("Connecti on Failed.");
exit;
}

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

$myresult = pg_exec($connec tion,$query);
$num_rows = pg_numrows($myr esult);

if ($num_rows == 0) {
print("No records exist");
}
else {
print("<FORM METHOD=GET
ACTION=\"http://emma/rhaynes/hockey_table4.p hp\">");
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("dbn ame=hockey1 user=rhaynes host=emma");
if (!$connection) {
print("Connecti on Failed.");
exit;
}

$query = "select * from tradelist where year ~* '$year_to_searc h'";
echo $query;
$myresult = pg_exec($connec tion,$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($myr esult); $lt++) {
$year = pg_result($myre sult, $lt,0);
$manu = pg_result($myre sult,$lt,1);
$set = pg_result($myre sult,$lt,2);
$card_number = pg_result($myre sult,$lt,3);
$player = pg_result($myre sult,$lt,4);
$condition = pg_result($myre sult,$lt,5);
$quantity = pg_result($myre sult,$lt,6);
$value = pg_result($myre sult,$lt,7);
print("
<tr>
<td>$year</td> <td>$manu</td> <td>$set</td> <td>$card_numbe r</td>
<td>$player</td> <td> $condition </td> <td> $quantity </td>
<td>$value</td>

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

?>
<a href ="http://emma/rhaynes/hockey_table4.p hp">Search Again</a>
</body>
</html>
Jul 17 '05 #1
2 5314
I noticed that Message-ID:
<2c************ *************@p osting.google.c om> 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
1737
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 a private member of the class Account. I have a public function called getBalance(). I have another public function called deposit, which I pass the balance (by calling getBalance() using pass by reference) and a second value for the amount of...
17
9391
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 commands on the same connection. I have an understanding that if SqlConnection is passed as "value" (unboxed), object B will create its own copy of SqlConnection, so when object A closes its connection, it remains open for object B's copy. Is this
6
2346
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 solution. My code can be downloaded from here: http://www.tprimke.net/konto/PyObject-problem.tar.bz2. There are some scripts for GNU/Linux system (bash to be precise). All you need to know is that there are four classes. (Of course, you may...
39
19646
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) What's the difference between these 3 statements: (i) memcpy(&b, &KoefD, n); // this works somewhere in my code
17
2330
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 << endl;
0
1814
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 is now updated to accept one more additional argument ). The problem in detail is as follows: I have a Class (named Student ) in an existing VC++ project. One of its Methods has the following signature and accepts 2 arguments ...
1
1974
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. function foo2(){} function foo(func){}
35
3230
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 instance of an object" for the line 'If mpg.FindControl("lkred").Visible = True Then'. I couldn't find sofar the solution. Any help would be appreciated ... Thanks
11
3360
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 ways of passing an array. In the following code, fun1(int a1) - same as fun1(int* a1) - where both are of the type passed by reference. Inside this function, another pointer a1 is created whose address &a1 is different from that of the passed...
0
9487
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.