Jump to content

Uses of urlencode() and urldecode()


nloding

Recommended Posts

Alright, so I am completely new at programming in PHP.  I've done tons of CSS and HTML before, and a tiny bit of a Javascript.  Now I want to start building larger sites based off databases, and need some help with PHP.  This should be relatively easy (I hope!)

Basically, here's what I want to setup: a database that has, say, an image and a dateline, and I want a single PHP file to bring it up and display it via urldecode() ...

http://domain.com/images.php?title=amazon

images.php would be one page, and then you click a picture, and it reloads the page, showing the picture and it's description.

This is popular everywhere.  I downloaded some open source code to programs like Joomla, Typo3, Phorum, and others, and I can't find a clean example I can completely comprehend.

Is there a tutorial out there about this?  Where would I begin in designing this site (assuming the database is complete)?  Are there any clean examples out there that I can study?

THANKS!

Great information on this site -- I'll be spending a lot of time here as I learn more and more PHP ...

--Nathan
Link to comment
Share on other sites

As an addition, I mean this as something a search engine, rather than displaying a completely new page.  The idea is that the page has a set layout, and certain parts, such as the img url, are filled in from the accessed mySQL database.  I'm looking for an example of that.
Link to comment
Share on other sites

i think what your asking is a ajax enstention of javascipt.

if you wanted to do this with php then your have a picture with a link going to another page showing that picture and the information.

but to have a picture to be pressed then the information displayed auomatickly on the same page your have to use ajax ok.

good luck.
Link to comment
Share on other sites

First off, presuming you don't know, urlencode and urldecode only convert unsafe characters to safe ones for building a URL, they don't do any file transfers etc.
So, if the image's name was [b]WickedImg//Deadly\\[/b] then when you put it on the end of a URL, the browser might think that it's a folder etc., so you should do this:
[code]$url = 'http://domain.com/images.php?img='.urlencode($imgName);[/code]

Onwards, if you don't need it to update on the same page then it shouldn't be too hard.
I can give more help if you know exactly what you want.
Link to comment
Share on other sites

I'm pretty sure AJAX isn't what I need for this, but then again, I don't know.  Here's the exact use, and what I want to do:

I'm building a database of movies, that will have several parts to it (i.e., director, actors, rating, plot, etc.).  What I want to create is a single php document, movies.php let's say, that calls up each individual movie in the database.  So say I put up a list of new releases for this week, the person would go to my site, and click "New Releases" -- that would take them to movies.php, which will list the titles for that week.  That someone clicks on Basic Instinct 2 ...

http://domain.com/movies.php?title=basic_instinct_2

The page reloads, and presents the information pulled from the database (director, actors, whatever).

I assume this is done using PHP to retreive information from a MySQL database, and not done with AJAX.  The other thing I thought about doing was using XML -- each movie would have it's own XML document, and then presenting it.  Is there a better way of doing things?

Eventually, there may be hundreds of movies in the database -- for now, there will be less than 50.  Any thoughts?

--Nathan
Link to comment
Share on other sites

It might be easier to try some basic tutorials first on this site to get to grips with php even if they're not really related to what you are trying to do. Many of the basic concepts will apply and you will find it much easier to think about going about your task with some basic knowledge
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.