Jump to content

What's wrong?


Pi_Mastuh

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? ???
Link to comment
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.
Link to comment
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?
Link to comment
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.
Link to comment
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
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.