Copy link to clipboard
Copied
Hi,
Need more assistance please. Ok so I've created this database driven site. Everything works perfectly but when my pages redirect it does not send the id value to the next page if i add "?id=5" manually in the browser address bar then it displays the correct details for that particular id. How do I use dreamweaver to send the valuefor me so that the site functions correctly? Do I have to physically code the php or is there a Dreamweaver function that can do this for me?
Please can you assist.
Thanks,
Owen
Owen,
Provide your query for a more thorough recommendation. Shooting in the dark is not desired by volunteer contributors of this forum. Ideally the session for user id should be created upon login, not defined based off the result of a query later on.
You wrote:
So what I want to do is once a user registers on the register page the page needs to redirect to a success page and have a message "Thanks User X for registering."
You can also do this by simply echoing the post value on registration succe
...Copy link to clipboard
Copied
Need more info. What server behaviour are you working with? In some, there is a checkbox that you can select to pass a value in the querystring.
What does this ID represent in your application?
Copy link to clipboard
Copied
The "id" is the auto-increment primary key which I want to use to identify users on the site. It is automatically created and users cannot edit the id field. So what I want to do is once a user registers on the register page the page needs to redirect to a success page and have a message "Thanks for registering."
The site redirects to the success page but it does not send the user data across. Once I manually edit in the address field by typing, "?id=2" then it does bring up the data for user where id = 2. I want dreamweaver to send that "id =2" automatically to the browser address bar.
Copy link to clipboard
Copied
Your method is a bad idea for at least two reasons: 1. it adds parameter to the URL, which = ugly. 2. Without additional coding anyone can change the URL parameter to see other results.
Preferred method is to create a session variable for logged in user id then filter your query where session = id, not URL parameter.
best,
Shocker
Copy link to clipboard
Copied
Thanks Shocker, but question remains. How do I do that?
Copy link to clipboard
Copied
Bregent suggested that more information would be helpful in giving you an answer, and generally the more information people have the better position they are in to give you an answer.
The shocker suggested a session variable, which would probably work, but again, more information would be better.
A session variable is a variable that lives until the session is closed, or when the browser is closed.
If your user's id is being called from a db, creating a session variable for it may look something like this
$_SESSION['id'] = $row['id'];
You would also need to have this on everypage you wish to carry this information
session_start();
Gary
Copy link to clipboard
Copied
Owen,
Provide your query for a more thorough recommendation. Shooting in the dark is not desired by volunteer contributors of this forum. Ideally the session for user id should be created upon login, not defined based off the result of a query later on.
You wrote:
So what I want to do is once a user registers on the register page the page needs to redirect to a success page and have a message "Thanks User X for registering."
You can also do this by simply echoing the post value on registration success page of the username 'name' that was 'named' whatever in the registration form. If registration form field for username is named username then echo on success page by entering this php
Thanks <?php echo $_POST['username']; ?> for registering.
Post values only survive the duration of one pageload. After that they are destroyed. So if you want to retain the data to display later on then you must create a session variable for the post value. Google the term how to create session variable or similar term and you will undoubtedly find countless resources that completely explain the process.
Keep in mind that by default Dreamweaver login server behavior automagically creates SESSION['MM_Username'] for the username of the logged in user. Simply echo the SESSION['MM_Username'] to display the username for the logged in user.
Look here: http://cookbooks.adobe.com/post_Display_user_s_name_and_other_details_after_login-16672.html
best,
Shocker
Copy link to clipboard
Copied
Hi Shocker,
Thank you. Your last post assisted greatly in resolving what I tried to achieve!
I found what I was trying to!!!