473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Passing data over web pages

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
Aug 14 '07 #1
4 1093
pbmods
5,821 Expert 4TB
Heya, Eduardo. Welcome to TSDN!

The easiest way to do this is to pass your variables in the URL:

Expand|Select|Wrap|Line Numbers
  1. <a href="somepage.php?bookname=name+of+the+book"> ... </a>
  2.  
And then in your PHP file, you can access the variables using the $_GET superglobal:
Expand|Select|Wrap|Line Numbers
  1. echo 'You picked the book entitled, "', $_GET['bookname'], '"';
  2.  
For more information, check out this document.
Aug 14 '07 #2
nathj
938 Expert 512MB
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
Aug 14 '07 #3
kovik
1,044 Expert 1GB
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.
Aug 14 '07 #4
nathj
938 Expert 512MB
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
Aug 15 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
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:...
1
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:...
3
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...
4
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...
5
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...
1
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...
2
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...
7
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?
10
nathj
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...
3
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
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
marktang
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,...
0
jinu1996
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...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.