PDA

View Full Version : (HTML) Sending images to another page



LivingShadow
Jan 25th, 2009, 08:44 PM
What I'm trying to do is:
-When you click image example.com/img53546 from example.com/store to example.com/items
-Now, I found this:
http://forums.codewalkers.com/client...ther-8258.html
This guy seems to have the same general idea as I do, so on the page where the image originally is, I modified his code to meet my purpose:

<head><title>Testing Vars </title></head>

<body>

<a href="stortrsinvent-h4.htm?$name=AxeofPrecision">Axe</a>

</body>
stortrsinvent-h4.htm is where I want to send Axe(I don't have the image yet)

And on stortrsinvent-h4.htm I put this:

<html>

<body>

<?
echo ("Testing, {$_GET['name']}!");
?>

</body>
</html>
Now, when I click Axe, it goes to the page, but the word Axe is nowhere to be found...
What did I do wrong?

Common
Jan 25th, 2009, 08:56 PM
You're going wrong a couple of places.

First off, the link should be: <a href="stortrsinvent-h4.php?name=AxeofPrecision">

Secondly, see that bit between the <? ?> tags? That's PHP. Therefore you need a PHP enabled web host and to save this to a .php file.

Then with that code it'll print "Testing, AxeofPrecision!".

Also, just to be compliant you should change your php tags to <?php and ?>

LivingShadow
Jan 25th, 2009, 09:05 PM
Why should it be .php? The page is .htm
Well, what I'm working with, its an HTML page only...
Is there a way to put that code into HTML?
Regardless, I should get rid of the Testing.

Common
Jan 25th, 2009, 09:10 PM
Well, the page as you have stated is .htm... but in order to run the code which youve put on it, it needs to be .php.

And no, so far as I know, theres no way to do that with HTML... HTML's a static language, just printing data as is coded. You could, however, do it with some pretty complex javascript which im sure you could find somewhere on the web.

LivingShadow
Jan 25th, 2009, 09:12 PM
I can run javascript on an HTML page, can't I?
Using <script language=Javascript>? But what would I put at the end of the Javascript code? </script>?

Common
Jan 25th, 2009, 09:17 PM
Yup, exactly like that. Why exactly is it that you need to pass these variables anyway? I cant think of many uses just on static HTML pages.

Here's a link to what you need btw:
http://www.dynamicdrive.com/forums/archive/index.php/t-11883.html

Edit: I think the actual proper way (as in the way the w3 like it) is <script type="text/javascript"></script>

LivingShadow
Jan 25th, 2009, 09:28 PM
The use, is a complicated one. I'm trying to get started on a little virtual world. I know it will probably be very difficult, and will involve a lot of complicated coding, and thats why I'm taking it one step at a time. I've already learned a lot about site coding since I decided to start this project. At the moment, I'm manually running it.
Thanks for the help. I'll check out that link.