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
4 1093
Heya, Eduardo. Welcome to TSDN!
The easiest way to do this is to pass your variables in the URL: -
<a href="somepage.php?bookname=name+of+the+book"> ... </a>
-
And then in your PHP file, you can access the variables using the $_GET superglobal: -
echo 'You picked the book entitled, "', $_GET['bookname'], '"';
-
For more information, check out this document.
Hi,
One thing to remember when passing data around like this, especially if it is in the query string (added to the end of the URL) is that it is user input and needs to be stested thoroughly before you use it.
I recommend checking that you have the data, then if you do , check that it is within the range of accepted values - so a numeric value is best for this.
In your case, assign each book a number and pass the number. Then you can check that the number has been set in the url and that it is within the define range. This allows you to handle any exceptions.
You can also check, via $_SERVER['HTTP_REFERER'], if the visitor has accessed the current page via the correct process. This will enable you to check if anyone is trying to get to extra page directly rather than via your pre-determined path.
Hopefully that will help to solve your problem and keep things nice and secure.
Cheers
nathj
You can also check, via $_SERVER['HTTP_REFERER'], if the visitor has accessed the current page via the correct process. This will enable you to check if anyone is trying to get to extra page directly rather than via your pre-determined path.
Do everything nathj said except for this part. HTTP_REFERER is handled client-side and can be altered and / or not sent at all. It's useful for some things (like highlighting search terms if a user comes from a search engine), but for anything that has to do with usability, security, or is *necessary*, you shouldn't bother with it.
Do everything nathj said except for this part. HTTP_REFERER is handled client-side and can be altered and / or not sent at all. It's useful for some things (like highlighting search terms if a user comes from a search engine), but for anything that has to do with usability, security, or is *necessary*, you shouldn't bother with it.
Hi Volectricity,
Thanks for the tip. I hadn't really thought about it like that.
Cheers
nathj
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Paul |
last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and
session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
|
by: Kevin Lyons |
last post by:
Hello,
I am trying to get all of my form elements passed correctly from the
following URL:
http://www.dslextreme.com/users/kevinlyons/selectBoxes.html
to the following URL:...
|
by: Simon Harvey |
last post by:
Hi,
In my application I get lots of different sorts of information from
databases. As such, a lot of information is stored in DataSets and DataTable
objects.
Up until now, I have been passing...
|
by: Gibs |
last post by:
Hi
I have two aspx pages in a frame and in the top page i am
creating the controls dynamically and putting in a place
holder. I have a hyperlink in this page to populate the data in
the bottom...
|
by: Rod |
last post by:
I've written 2 ASP.NET applications (I've worked on one with a team and
another by myself). In my ASP.NET pages, when saving data to a backend
database I've done it by using the click event of a...
|
by: olduncleamos |
last post by:
Hello all.
With a background in ASP, I am finding the work required for passing
values between pages mystifying. For various obvious reasons, I have
eliminated using cookies and session to store...
|
by: Roy |
last post by:
Hey all,
Is it possible to pass session variables between pages in separate
projects?
For example:
inetpub\thisproject\blah.aspx
has a session variable and response.redirects the user to...
|
by: Smokey Grindle |
last post by:
For a website that has users logged into it using sessions, its it best to
pass data between pages in session variables or through query strings?
|
by: nathj |
last post by:
Hi,
Part of one of my current projects is to provide an application form. This form needs to get quite a bit of data, so rather than have one really long form on one page I have split the data...
|
by: dbuchanan |
last post by:
newbie question
What are the various ways that data can be passed between pages.
For example; How is data about the logged in user passed to subsequent pages
Thank you,
Doug
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |