Reply to Re: <a href ..>Setting a variable before the page calls itself

Your name:

Reply:


Posted by Erwin Moller on 02/27/06 13:26

universalbitmapper wrote:

> Hi,
>
> This exercise (From PAM525Web Development) asks me to display a table
> of reviews, then sort the reviews depending on which column heading is
> clicked.
>
> I can't find how to write this line:
>
> <th><a
>
href=movie_details03.php?movie_id=$movie_id&coll_sort=\"review_date\">"Date
> of Review"</th>
>
> in this bit of code:
>
> $review_table_headings=<<<EOD
> <tr>
> <th><a
>
href=movie_details03.php?movie_id=$movie_id&coll_sort=\"review_date\">"Date
> of Review"</th>
> <th>Review Title</th>
> <th>Reviewer Name</th>
> <th>Movie Review Comments</th>
> <th>Ratings</th>
> </tr>
> EOD;
>
> The coll_sort variable is extracted by a GET


Hi,

You don't want " or ' in your url.
use urlencode to pass them around safely.
So try:
<?
$myUrl = "movie_detailso3.php";

// assuming $movie_id is a number, you do not need urlencoding
$myUrl .= "?movie_id=".$movie_id;

// assuming coll_sort need encoding:
$myUrl .= "&amp;coll_sort=".urlencode("revie_date");
?>
<a href="<?= $myUrl ?>">sort on review date</a>

Now receive it like:
$sortorder = $_GET["coll_sort"];

Also note the &amp; instead of &. It was not your problem, but the &amp; is
better, according to W3C.

Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация