Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

When & how to use parameters when creating a link

Posted 12 Feb 2005 21:14:24
1
has voted
12 Feb 2005 21:14:24 Raul Raulito posted:
Hi,

I am trying to learn how to use dynamic pages and am doing the blog tutorial on this web site:

www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1_08.html

I am fine actually following the tutorial,but to be honest do not understand the concept behind the use of the parameters box when creating links to other pages and how to use and understand the reason behind completing the 'name' and 'value' space.

Does anybody have any suggestions to get me up to speed understanding all this so I can apply all this to my own personal pages?(possible web pages,... other examples to follow,.... )

Thanks!!

Replies

Replied 13 Feb 2005 12:35:44
13 Feb 2005 12:35:44 Vince Baker replied:
Hi Raul,

There is a very good tutorial in Dreamweaver under the help menu option that talks you through the whole logic of why and how to set up a dynamic site.....

Can you give me a couple of examples of things you want on your site and I will try to explain how the name and value space would relate to that.

I take it you are using a database with you site ?



Regards

Vince Baker
<strong>DMX Zone Manager</strong>

[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Replied 13 Feb 2005 16:00:01
13 Feb 2005 16:00:01 Raul Raulito replied:
Hi,thanks for your time to reply,..

Yes I am using a MySQL database.

I am following a tutorial from the macromedia web page,

www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1_08.html

I do understand the concept of dynamic web pages.

What I do not fully understand is how to complete the parameters when creating links to other pages.

So say you have a page named test.php and you want to link it to test1.php:

I then go to the link field in the properties panel, then hit browse for file, and select the file (no problem with all this),

The prob comes trying to understand how to complete the parameters box with name and value. I have my record set created and am happy with the concept of record set, it's understanding what 'name' and 'value' actually stands for.

I have tried playing around with it myself and seing what happens when adding different names and values from the record set, but would be helpfull to find some kind of explanations on the web regarding all this,(I have done several google searches),..

So any suggestions! will be helpfull!
Thanks for your time!
Replied 13 Feb 2005 21:22:10
13 Feb 2005 21:22:10 Simon Martin replied:
HTML is a stateless protocol so there is no native way for a selection on 1 page to be 'remembered' on the 2nd page.
Enter the Name Value pairs.
They are just a means of passing some information between pages, very useful if you want to filter a recordset on the 2nd page. For instance on page1 you select the blog you are interested in reading, a request is then sent to the server for page2 - but if you don't tell it which blog you want to read then the recordset will simply pick up all the records and display only the 1st.
So you can pass the ID of the blog that the reader has selected in the url for page2.
The name you assign is really up to you; but with all coding a short descriptive name is best.
The value should be the ID you need to pass to the 2nd page so that you can display the correct record.

There is nothing wrong with www.mysite.com?thisistheblogidthatineedtopass=10 but www.mysite.com?blogID=10 is much easier to handle, fewer chances for a typo!
Ideally the value is dynamic and the parameters box is a really easy way to select the item from the recordset on page1 that you need to pass to page2

HTH

Live the life you love
Love the life you live
~ ~ ~ ~ ~ ~ ~
<b>Simon Martin</b> - <i>DMXzone Manager</i>
<font size=1>[ Dreamweaver MX/MX2004 | ASP | SQL | XHTML/CSS | Web Accessibility ] </font id=size1>
Replied 14 Feb 2005 18:47:48
14 Feb 2005 18:47:48 Raul Raulito replied:
Hi Vince/Simon,

Thanks for taking your time to reply, I have read through them and have helped me understand a bit more about all this parameters stuff.

In adition I managed to find this page which is also quite usefull:

livedocs.macromedia.com/dreamweaver/mx2004/using/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Using_Dreamweaver&file=35_con17.htm

Please feel welcome to add any extra info.

Basically all I am tring to do is:

I have one MySQL database and two tables. First table has the following fields:

First name,last name,hobbies.

Second table:

telephone number,Address, favourite books.

So far I have designed my first php page which shows the information from the first table. I created a record set and inserted a dynamic table using this recordset. I then linked the field first name to a second php page.

Now this is what I want to do:

if the user hits the link from record number one from my first php page I'd like the second page to show the information from record number one from my second table, therefore showing 'telephone number, address and favorite books.

if the user hits link from record number two from the first page,I'd like the second page to show the information from record number two from the second table and so on,...

I think I have almost understood how to do this,...
Will let you know once I've managed to do so!
Replied 14 Feb 2005 19:30:52
14 Feb 2005 19:30:52 Simon Martin replied:
ahhh
you need to create a relationship between the 2 tables
each table <b>really</b> ought to have a unique primary key. natural examples of which are passport numbers, social security number, car license number. This means that even though 2 records may have the same data (e.g. same name and surname) the Primary Key is different and so you can still pick out the record you want to.

So if you add a PK to each of your tables the next thing is to link the 2 tables by posting the PK from the 1st table into the 2nd. This way the records in table 2 belong to the record in table1 - check out this article www.dmxzone.com/showDetail.asp?TypeId=28&NewsId=5831 for a bit more detail.

Then the link in your repeat region in page1 needs to pass the PK to the 2nd page. This is where you use the parameters.
I would probably use userID as the PK in table1 - and pass that in the parameters.
so your name would be userID and the value would be the ID number assigned to that user in the table.

If you get stuck post back with what you've got and I'll try and help you work out what's going on there

Live the life you love
Love the life you live
~ ~ ~ ~ ~ ~ ~
<b>Simon Martin</b> - <i>DMXzone Manager</i>
<font size=1>[ Dreamweaver MX/MX2004 | ASP | SQL | XHTML/CSS | Web Accessibility ] </font id=size1>
Replied 15 Feb 2005 20:06:46
15 Feb 2005 20:06:46 Raul Raulito replied:
Hi,thanks again for taking your time to reply!

Just to let you know the info you provided came in very handy! and have managed to make things work!

Thanks again!
Raul

Reply to this topic