Jump to content

pass a value or something like it


Recommended Posts

Hello my name eduardo consolacion, i just want to ask some of your help to answer the question that i am longing to get it. Using PHP, I want to know how to pass a certain value or anything like it when you try to click a "picture of a book" or its "name" to be pass on another web page that will show the "book picture", the "price of the book" and the "description" of it? i do hope that you could help me with this? i would thank you in advance for everything. thank you again and have a pleasant day ???

Link to comment
Share on other sites

How about this: in booklist.html

<html>
<body>
<a href='bookinfo.php?book=0'><img src='images/ToKillAMockingbird_small.jpg' /><br />
To Kill A Mockingbird</a>
<a href='bookinfo.php?book=1'><img src='images/PeterPan_small.jpg' /><br />
PeterPan</a>
<a href='bookinfo.php?book=2'><img src='images/WutheringHeights_small.jpg' /><br />
Wuthering Heights</a>
etc...
</body>
</html>

 

and then in bookinfo.php

<html>
<body>
<?php
$book = $_GET['book'];
$pictures = Array("images/ToKillAMockingbird_large.jpg", "images/PeterPan_large.jpg", "images/WutheringHeights_large.jpg");
$prices  = Array("\$15.99", "\$12.95", "\$23.98");
$descriptions = Array("Story about racism", "Children's story", "Boring Story");
echo "<img src=".$pictures[$book]."><br><b>Price:</b> ".$prices[$book]."<br><b>Description:</b>".$descriptions[$book];
?>
</body>
</html>

If you have a large number of books, consider using a database.

 

Hope that helps.

Link to comment
Share on other sites

Good Day, I just recieved and read the response today you gave me. I tried doing it first as a trial, when suddenly it outputs what i wanted. I couldn't ask for more. By means of gratitude, i would like to say, "Thank you sir/madam for giving me the answer that i was looking for. And, thank you as well for the idea on how to solve this problem of mine that takes only just an e-mail of a second to do. I really appreciate all the things and effort that you have done and that you have given me. What else can i say, but to say "Thank you and  for helping me." Take care and have a wonderful day! Bye"

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.