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
https://forums.phpfreaks.com/topic/64792-pass-a-value-or-something-like-it/
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.

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"

Archived

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

×
×
  • 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.