Jump to content

[SOLVED] urlencode help


adam291086

Recommended Posts

I am setting up the urls on my site. But two of the links need to stay as http://www.ryedalerumble.com/riders.php. When i test the links everything work ok until the user goes to the riders.php page. When they try and navigate away the url goes to www.ryedalerumble.com/riders.php?page=index instead of www.ryedalerumble.com?page=index.php. Heres the code

 

echo '<li><a href="http://ryedalerumble.co.uk?page='.urlencode('Entry Form').'">Entry Page</a></li> ';
echo '<li><a href="http://ryedalerumble.co.uk?page='.urlencode('Useful information').'">Useful Information</a></li> ';
echo '<li><a href="http://ryedalerumble.co.uk?page='.urlencode('Faq').'">FAQ</a></li> ';
echo '<li><a href="http://ryedalerumble.co.uk?page='.urlencode('index').'">Latest</a></li> ';
echo '<li><a href="http://ryedalerumble.co.uk?page='.urlencode('index').'">Gallery</a></li> ';
echo '<li><a href="http://ryedalerumble.co.uk?page='.urlencode('index').'">Results</a></li> ';
echo '<li><a href="http://ryedalerumble.co.uk?page='.urlencode('index').'">Comments</a></li> ';
echo ' <li><a href="http://ryedalerumble.co.uk/riders.php">Riders</a></li> ';
echo ' <li><a href="http://ryedalerumble.co.uk/view_all_news.php">View all news articles</a></li> ';
echo '<li><a href="http://ryedalerumble.co.uk?page='.urlencode('Contact_Us').'">Contact Us</a></li> ';

Link to comment
Share on other sites

Your missong the /

 

echo '<li><a href="http://ryedalerumble.co.uk/?page='.urlencode('Faq').'">FAQ</a></li> ';

 

Also...

 

Why are you using urlencode on strings that don't contain any special chars?

Why are you hardcoding the domain name into all your scripts?

Link to comment
Share on other sites

thanks that works now

 

one more problem. I have some links that i want to keep redundant. So if you click on it the page goes know where. How would i do that. I have tried using # but the site still changes the page

 

echo '<li><a href="/?page='.urlencode('#').'" class="parent">Routes</a></li> ';

Link to comment
Share on other sites

adam291086, you really don't need to urlencode those variables.  The only characters to get encoded would be the spaces in 'Entry Form', which would become Entry%20Form, something you can write yourself.

 

thorpe is right, no need to hard code here

 

echo '<li><a href="/?page=Entry%20Form">Entry Page</a></li> ';

 

the empty anchor link you want is <a href="#">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.