View Full Version : Using URL Parameters..or not

05-04-2005, 09:36 AM
Hello all,

For a few days now I have been trying to do what I suspected isn't too difficult - but have continually failed in my attempts :( .

I have a MySQL database of user profiles. I want my users to be able to access their profiles and update them (PHP). I only want them to be able to access and update their own profiles.

Basically I want to have the user log in (with their password and email address) and go directly to the update page of the record corresponding to their entered password and email.

I have managed to create the log-on page and have also created an update page, however when the user logs on they are not directed to their corresponding record, rather the first record on the database.....

I have tried a couple of things. (none of which worked).

Firstly I created a log-on screen using the dreamweaver new login server behaviour (using a password and email as the logon requirements).

This worked to an extent but when the user logged on, they were not directed to the record with the corresponding email and password, rather the first database record entry. After a bit of searching around, I came to gather that I need to send a URL Parameter and used a method similar to one I saw in the Master_detail tutorial in the dreamweaver developer area. However I could not get it to work to my needs.

My second attempt was to create a form with the following SQL Statement SELECT *
FROM TestTable
WHERE contactmail = '". $POST['email']. AND password = . $POST['password'].'"

But again, the URL parameter caused me problems.

Any advice on this would really and truly be greatly appreciated.

Many many thanks.

05-05-2005, 12:18 PM
Hello again,

Managed to do what I was trying thanks to the Dreamweaver built-in wizards and server-behaviours.


05-05-2005, 01:45 PM
jool can you tell us how you achieved this?:) (even though we were not able to help you :unsure: )

05-05-2005, 04:44 PM
Mmm....after testing my 'accomplishment' I've realised it doesn't work <_< . The logon form, using the Login Server, doesn't redirect the user away if they enter the wrong Login details......

Frustrated by this I then changed it slightly (but am not really satisfied with what I have), so when the user logs on, s/he is directed to another screen.

This screen has essentially 2 small textfields (encased in forms (Update and delete)). If the user enters their password (again) and presses the button they are then directed towards an update form screen. This is done by passing a form variable through, and picking up the records associated with that variable via a recordset.

The screen previous to the update screen (the screen with the 2 forms) has also a delete record button which is supposed to delete the record associated with the password which is entered into the textfield and entered.

Anyway, this does't work either. Basically, it's all looking a bit shoddy. Don't think this is much of a help to anyone, but I'll let you know if I can work it out.


05-05-2005, 06:45 PM
Okay, what I have done now is just create a simple form with 2 text areas.

One textfield called PasswordID and the other textfield called contactID

The form action specified in the property inspector goes to Update.php

In Update.php I created a another form and in it, textfields corresponding to the values I would want the user to be able to edit.

I then created a recordset (Bindings, +, Recordset(query).

I selected the ADVANCED recordset view and entered the following SQL

FROM TestTable
WHERE password = 'colname' AND contactmail = 'colnames'

Under variables I entered the following:

Name Default Value Run-time Value
colname 1 $_POST['passwordID']
colnames 1 $_POST['contactID']

Now I did this because I saw a similar tutorial that used the simple record set and entered the following under the FILTER SECTION:

ID =
Form variable passwordID

I did this and when I switched to the Advanced view I saw

FROM TestTable
WHERE password = 'colname'

Name Default Value Run-time Value
colname 1 $_POST['passwordID']

Anyway, this works to the extent where if the user enters the correct email and password, they are then directed to an update page featuring their profile.

However if they do not enter the details correctly, they are still directed to an update page, only there are no values displayed in the update page. Obvioulsy this isn't so great, and they should be re-directed to a screen telling them their log-in details were incorrect. Don't know how to do this though..... Any advice would be appreciated and I'll put a posting back up if I can find out myself.


05-05-2005, 07:10 PM
Happy Days....

Just added this line ( a helpful guy called Havin_it from another forum) just before the php code ended:

header("Location: http://www.example.com/rejected.php"); ('http://www.example.com/rejected.php");')

and it diverted those with incorrect login details to the rejected.php page.

So I'll say that's good enough for the moment, however I'm sure there's several things I've overlooked.

Anyway, bye!

05-06-2005, 11:43 AM

If only.....

What happens now is when I press the update record behaviour, instead of going to the page I specified in the Update record dialogue box, in the After updating go to column the page is directed to http://www.example.com/rejected.php ('http://www.example.com/rejected.php') (this is the page I specified for people entering incorrect uder details)

Sigh.... :( :(

05-06-2005, 12:04 PM
Yes, indeed there is something I have overlooked :(

So, this worked and if the user entered the correct email and password details they would be forwarded through to my update page. However, after making the updates, and pressing the update button, the user was then directed to :

("Location: http://www.example.com/rejected.php"); ('http://www.example.com/rejected.php");')

and not the page I had specified in the Update Record Set, using the UPdate Recordset behaviour.

Any help, as always, would be greatly appreciated...


05-06-2005, 02:26 PM
Are u using DMX 2004 (version 7+) or DMX (version 6+)?

Depending on the above there are much simpler ways of acomplishing user login using builtin server bahaviors on version 7 and third paety extensions in 6

05-06-2005, 03:35 PM
....version 7.0.1

05-06-2005, 04:15 PM
await a mini tutorial today....

05-06-2005, 05:17 PM
thanks ranjan!

Looking forward to it :D

05-06-2005, 05:56 PM
ranjan, will it be good enough for a full article linked in from the homepage? :)

05-06-2005, 07:15 PM
The file is being uploaded as I type this message....

A few things to note.

1. The tutorial is 2 flash movies zipped in a single file
2. The file size is large 5 MB + zipped, I am sorry about this...
3. The tutorial assumes your database is already created.
4. Since the file size is huge it will stay on my server for only 24 hours... i am sorry

Whether its good enough to be linked from the frontpage is for the admins to decide, if it is you may use it as you like....

The url follows as soons as it gets uploaded (Update : link is as below)

http://ranjan.ws/whims/user.zip ('http://ranjan.ws/whims/user.zip')

05-06-2005, 07:49 PM
Thanks a lot Ranjan!

I've just downloaded it, and will take a look now.

I'll write again, to let you know if I get stuck....

05-06-2005, 10:13 PM
Great tutorial Ranjan!

I've just finished now, and I think everything is working as I had hoped. Great tutorial and very easy to follow. I'm very appreciative of your help.

Hope you have a brilliant weekend.

:D Cheers! :D

P.S. Admin - it's a good tutorial and if you want a written version of it, I can write it up - although the flash version is very easy to follow. Let me know.

05-06-2005, 10:19 PM

05-07-2005, 12:03 AM
Can I remove the file from my server?

05-07-2005, 10:34 PM
Yes, you can. I had downloaded it.