Re: Can't seem to transfer a dynamically chosen parameter to next page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Bill

I mixed up names and ended up answering the wrong message. Sorry.

Actually it is quite easy...

In viewallorders.php you should replace:

echo "<a href='showorder.php?$name '>";

with

echo '<a href="showorder.php?&name=' . $name . '">';

and then, in showorder.php

<?php
parse_str($_SERVER['QUERY_STRING'], $qs);
$name = $qs['name'];

and that's it!

Now, the strings passed through this method are insecure. You should use
a parser function to clean or sanitize them (like urlencode/urldecode).

Cheers
JP





-----Original Message-----
From: Bill Mudry <billmudry@xxxxxxxxxx>
To: php-windows@xxxxxxxxxxxxx
Subject:  Can't seem to transfer a dynamically chosen parameter
to next page
Date: Tue, 17 Mar 2009 11:39:08 -0500

I hope someone has an answer to what has been a thorny problem for 
me. I am still junior to using PHP.
I have a script that displays a bunch of woody botanical orders out 
of a MySQL file nicely in columns.
That part works fine.

Next what is wanted is for a user to be able to click on one of them, 
the result being that it would open up
a new page that would get details on the woody order the person chose 
out of another MySQL table.
Well .... I got it to link to a page that opens up ok ---- except 
after numerous attempts and ways I cannot
get the name of the chosen woody order to transfer to this next page.

	- the examples I have seen on the Internet and book use static 
information for the better part while the
	  very parameter that needs to be passed is derived dynamically. I 
am fairly sure that is complicating
	  things more.

	- Cookies would be an overkill and have too much persistence. I 
believe using "session" would be overkill,
	  too, even if it might work. All I need is to make the choice the 
reader makes go global enough to use it
	  in the very page that it calls. It is then also used both for 
titles on that page (dynamic) and to do a
	  query for information to display on that chosen order. Writing to 
a file seems to be an inefficient way if
	  there is only a way to just make it be memory resident instead.

The running copy can be seen and tried (to the degree it is working so far) at:
	http://www.prowebcanada.com/taxa/viewallorders.php

The files used are viewallorders.php and the response page of 
showorder.php. I will add these as attachments.

What *will* work? Hope someone can help.

Bill Mudry
MIssissauga, ON
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux