Jump to content


Photo

What's wrong?


  • Please log in to reply
6 replies to this topic

#1 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 27 August 2006 - 03:16 AM

I'm making a page where when you click on a picture a page pops up with the info about the item. i'm using
$itemName
and
echo '<img src=../images/items/'.$image.'.jpg>';
When the page comes up for an item with spaces in the name it just shows up as the first word and none of the data is displayed because it's an invalid item name. What's wrong? ???
Schroedinger's Cat walks into a bar.
And doesn't.

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 August 2006 - 05:09 AM

Without code to look at, it's anybody's guess as to what's wrong.

Is this some kind of database question?

Possibly solution if it is, would be to pass the database record ID instead of name. Alternatives are to use urlencode() and urldecode() [check the manual for details] so that the spaces in names can be handled.
Legend has it that reading the manual never killed anyone.
My site

#3 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 27 August 2006 - 05:15 AM

I don't know what you mean...
Schroedinger's Cat walks into a bar.
And doesn't.

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 August 2006 - 05:19 AM

I don't know what you mean...


OK, we're even.

You have some kind of problem with some kind of code and neither I nor anyone else can solve it without seeing some code. You already have my best guesses as to what the solution might be. Did you look at the manual pages for the urlencode() and urldecode() functions?
Legend has it that reading the manual never killed anyone.
My site

#5 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 27 August 2006 - 05:22 AM

What manual? And I posted the code up there. The rest is just the borders and stuff for the table.
Schroedinger's Cat walks into a bar.
And doesn't.

#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 August 2006 - 05:34 AM

The manual - www.php.net - has explanations and examples of 'everything' relating to php.  Here's an example - http://ca.php.net/ma...n.urlencode.php

As for posting all your code, no you haven't. You posted one img tag and a disconnected variable.  You don't show the code for what get's clicked and you show nothing whatsoever relating to details not showing when something is clicked.

If you want people to devote their time to your problems you need to develop two good habits.  #1 fully explain and illustrate the problem; #2 look at the manual references people offer in their replies.

Good luck with your problem.
Legend has it that reading the manual never killed anyone.
My site

#7 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 August 2006 - 02:26 PM

If people would get into the habit of enclosing values of attributes in quotes (double or single depending on the situation), problems like this wouldn't happen.

In your case:
<?php echo '<img src="../images/items/'.$image.'.jpg">'; ?>

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users