Jump to content


Photo

Uses of urlencode() and urldecode()


  • Please log in to reply
7 replies to this topic

#1 nloding

nloding
  • Members
  • PipPipPip
  • Advanced Member
  • 321 posts

Posted 09 July 2006 - 01:17 AM

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/im...hp?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

#2 nloding

nloding
  • Members
  • PipPipPip
  • Advanced Member
  • 321 posts

Posted 09 July 2006 - 01:33 AM

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.

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 July 2006 - 12:02 PM

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.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 09 July 2006 - 01:04 PM

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 WickedImg//Deadly\\ 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:
$url = 'http://domain.com/images.php?img='.urlencode($imgName);

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.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#5 nloding

nloding
  • Members
  • PipPipPip
  • Advanced Member
  • 321 posts

Posted 10 July 2006 - 08:49 PM

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/mo...asic_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

#6 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 10 July 2006 - 09:03 PM

It seems obvious to me to use a MySQL database for this, XML/AJAX etc. aren't needed.

<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#7 nloding

nloding
  • Members
  • PipPipPip
  • Advanced Member
  • 321 posts

Posted 10 July 2006 - 10:02 PM

I'm very new to MySQL and PHP ... are there any decent examples of something like this out there that I could study?

#8 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 10 July 2006 - 10:05 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users