Re: PHP URL issues

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

 



This may or may not help, but here's a few things to note:

1) I would avoid placing variable output in double quoted strings. While not 
important for smaller scripts, doing a large number of outputs like this 
causes a decent performance hit. In fact, I wouldn't use double quotes ever 
in php. Instead, strive for something like:

echo '<b><a href="test.php?term='.$letter_value.'">'.$letter_value.' 
&nbsp;</a></b>';

for your anchor statement. This translates to

echo '<b><a 
href="test.php?term='.$letter_value.'&amp;type='.$type_value.'">'.$letter_value.' 
&nbsp;</a></b>';

for your second one.

2) If you didn't notice above, I replaced your & with the html entity 
equivalent &amp;. I did this because I'm pretty stubborn when it comes to 
trying to keep things as close to strict following of the xhtml 1.0+ 
standards as I can.

If the URL still isn't working after that update, you have some more 
options:

1) First, I would double check that both variables have a value coming into 
that block of code. Output them before you create the url.

2) Then, I would isolate the url itself and see if you can print that out 
before putting it in the anchor statement. Something like:

$url = 'test.php?term='.$letter_value.'&amp;type='.$type_value;

If you can echo that out, try putting that value back into the anchor:

echo '<a href="'.$url.'">'.$letter_value.'</a>';

3) If that doesn't work, try just passing the second value that wasn't 
working before.

If none of that works, double check the spelling of all variables and 
possibly start attempting to typecast the values appropriately. I have a 
feeling, though, it won't make it this far and by doing one of the above you 
will notice things start working or the mistake you made.


"Don Don" <progwihz@xxxxxxxxx> wrote in message 
news:192604.43413.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> I've just noticed that if am passing only one value it works fine, but 
> when am passing in more than one none works.
>
>  Why is that or what could be wrong ?
>
>  e.g.  this works
>  echo "<b><a href='test.php?term=$letter_value'>$letter_value 
> &nbsp;</a></b>"; on test.php i can display the value of term but with this
>
>  echo "<b><a 
> href='test.php?term=$letter_value&type=$type_value'>$letter_value 
> &nbsp;</a></b>"; on test.php the values are empty.
>
> Nikola Stjelja <nstjelja@xxxxxxxxx> wrote:
>  If you are going to insert variables like $var_name in a string you need 
> to enclose that string with double qoutations marks, not single. PHP will 
> replace var names with values only inside double qoutations.
>
> Hope that helps
>
>  On 3/12/07, Don Don <progwihz@xxxxxxxxx> wrote:  I've got the following 
> url rewriting problem.
>
>  on page 1 i've got this
>
>  <p> <a href='page1.php?messageId=$tmpForum&userId=$user_id'> See </a></p>
>
>  and on page 2 i've got this
>
>  $messageID = $_REQUEST["messageId"];
> $userID = $_REQUEST["userId"];
>
>
> when i check to see the values of these variables its says its empty, but 
> when i place my cursor on the link in
> page 1 i can see both variables being show with their values in the 
> browser.  But on page 2 i cant get the values
> Something seems wrong perharps ?
>
>  Cheers
>
>
> ---------------------------------
> Now that's room service! Choose from over 150,000 hotels
> in 45,000 destinations on Yahoo! Travel to find your fit.
>
>
>
> -- 
> Please visit this site and play my RPG!
>
> http://www.1km1kt.net/rpg/Marinci.php
>
>
>
>
> ---------------------------------
> Don't get soaked.  Take a quick peek at the forecast
> with theYahoo! Search weather shortcut. 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux