Pi_Mastuh Posted August 27, 2006 Share Posted August 27, 2006 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? ??? Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 27, 2006 Share Posted August 27, 2006 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. Quote Link to comment Share on other sites More sharing options...
Pi_Mastuh Posted August 27, 2006 Author Share Posted August 27, 2006 I don't know what you mean... Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 27, 2006 Share Posted August 27, 2006 [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? Quote Link to comment Share on other sites More sharing options...
Pi_Mastuh Posted August 27, 2006 Author Share Posted August 27, 2006 What manual? And I posted the code up there. The rest is just the borders and stuff for the table. Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 27, 2006 Share Posted August 27, 2006 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.phpAs 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. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted August 27, 2006 Share Posted August 27, 2006 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.