Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using <A NAME> between pages 1

Status
Not open for further replies.

hpicken

Technical User
Joined
Apr 12, 2001
Messages
142
Location
AU
Hi

I'm using the following to get to another indexed page.
The page generates the <a name=&quot;blah&quot;> when created.

echo &quot;<a href=\&quot;../convicts.php?currltr=$conltr#$convict\&quot;>Click here.</a>&quot;;

This has been working fine, but I thought I'd change the code and auto redirect using the Header tag eg.

$URL=&quot;../convicts.php?currltr=$conltr#$convict&quot;;
header (&quot;Location: $URL&quot;);

This sends the user to the correct page but doesn't accept the #$convict because it is automatically rawurlencoded.
eg convicts.php?A#O\'Neill%20Tim

If I change the indexed page to use a rawurlencoded <a name> it works OK until I get to a hyphened name eg O'Neill.

The passed variable becomes O\'Neill. I can't seem to find a way of either stripping this or adding it the indexed page. This script handles the %20 (space) OK just not the appostrophy.

Anyone have any ideas?


Howard
 
OOPs that should be eg convicts.php?currltr=A#O\'Neill%20Tim

Howard
 
$URL=urlencode(&quot;../convicts.php?currltr=$conltr#$convict&quot;);
header (&quot;Location: $URL&quot;);

 
Change that to the following because of the / characters being encoded too

$URL=&quot;../convicts.php?currltr=$conltr#&quot; . urlencode($convict);
header (&quot;Location: $URL&quot;);
 
That changes the the passed var to
/convicts.php?currltr=O#O%5C%27NEILL+Tim

Ended up using

$URL=&quot;../convicts.php?currltr=$conltr#&quot; . urlencode(stripslashes($convict));

this worked.

Cheers and thanks LittleHavoc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top