Jump to content

Archived

This topic is now archived and is closed to further replies.

Pi_Mastuh

What's wrong?

Recommended Posts

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? ???

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote author=Pi_Mastuh link=topic=105779.msg422688#msg422688 date=1156655759]
I don't know what you mean...
[/quote]

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?

Share this post


Link to post
Share on other sites
What manual? And I posted the code up there. The rest is just the borders and stuff for the table.

Share this post


Link to post
Share on other sites
The manual - www.php.net - has explanations and examples of 'everything' relating to php.  Here's an example - http://ca.php.net/manual/en/function.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.

Share this post


Link to post
Share on other sites
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:
[code]<?php echo '<img src="../images/items/'.$image.'.jpg">'; ?>[/code]

Ken

Share this post


Link to post
Share on other sites

×

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.