...

View Full Version : How to pass info with URL



Uzair
09-18-2006, 02:45 PM
I have a list of some books. I want when somebody clicks any of the book, the next page should display its contents & the URL in the address bar should b like this...

http://mysite.com/book.htm?id=123&name=abc

Please somebody tell me how can I pass Book's ID & NAME with URL??????

ronaldb66
09-18-2006, 03:04 PM
This sort of thing is typically used with server side scripting, although you could hand-code all the links of course. You'd still need some form of processing on the side of the page these links point to; this could be done using JavaScript, but then all the information of all of the books has to be available on this page.

It would make more sense to store this information on the server somehow and use a server side script to process the query string, pull the desired information and create a result page.

Uzair
09-19-2006, 06:00 AM
Can u please gi'me any sample code for this. I could easily pick the method from the source code.

percepts
09-19-2006, 06:28 AM
where you have the list of books, each link from a book should look something like:

<a href="http://mysite.com/book.htm?id=123&name=abc">Book abc item nmber 123</a>


if you use serverside scripting to dynamically create the page with the list of books, then you create each book link with the books reference data.

Uzair
09-19-2006, 06:35 AM
Thats the problem Sir.
I dont know how to do this.
I'm sorry that I'm bothering u all but..... I'm very keen to learn this...
I've tried to find out any institute in my area but in vain :(
So please...... guide me if u can.....
I'll b very much thankfull 2 u all.

percepts
09-19-2006, 09:16 AM
If you want to populate the page automatically with the book details and links with the correct product id etc, then you will need to learn a server side programming language. One of the most popular is PHP which is a scripting language. It is usually combined with MySQL which is a database where you would store your data. In this case, that would be your list of books with title, product id etc. PHP code is embeded in the html file but before the html file is sent from the server to the users browser, the php code is parsed/executed on the server. Typically the PHP would fetch the data from the MySQL database and embed it in the html including building links with the data you want. As the php codes executes it dynamically builds the html and it is that html which is sent to the users browser. The php code is stripped out of the html file before its sent to the browser so the user never sees the php code. The user sees the output from the php code which is the dynamically built html.

In other words, you have a long and steep learning curve because you need to understand the relationships between html, PHP and MySql. Your best option is to buy a good book on PHP programming and then progress to MySQL.

The HTML is the easy bit. I suggest you ask in the PHP forum which is the server side forum. This is the client side forum which is not really dealing with PHP and MySQL.

Uzair
09-19-2006, 09:22 AM
Thank You Very Much Sir !



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum