Forum Moderators: coopster

Message Too Old, No Replies

putting info into a DB / passing info between pages

         

dave1236

3:23 am on Aug 4, 2006 (gmt 0)

10+ Year Member



I have run into an issue...I have posted previously, but my scenario has changed.

Here is the situation...

If a user clicks on a link ('abc123' for example) I want to insert into my database some predefined information about 'abc123' - I have assigned a value that is echoed in future pages for 'abc123'.

So, what I need is some mechanism to, when a user clicks 'abc123', have a pre-defined username and password be entered into the database. I need this so future pages can utilize the session values.

I am not sure if I am very clear what I am looking for.

jatar_k

11:25 am on Aug 4, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



let me reiterate to be sure I understand

user clicks link
you auto log them in based on what link
you save that info to their session for later use

should be pretty straight forward

they click
you select data from db based on which link
add the info to the session
you can echo it from the session later

was there some specific part of it that was giving you trouble?

dave1236

1:41 am on Aug 7, 2006 (gmt 0)

10+ Year Member



The specific issue I am having is this...

I have a drop down menu that consists of a number of choices...

"A"
"b"
"c"
etc.

a user selects the choice, hits a submit button. previously, i have used a simple html form that would apss the option value to the next page.

Here is what i am looking to do now...

using the same drop down menu, when the selection is made, a session logname is created that remains for each page.

i think i have a solution, and will try to implement it, but what i am trying to understand is how to i get the selection to be entered into the db?

does that help?

dave1236

1:43 am on Aug 7, 2006 (gmt 0)

10+ Year Member



so the issue is...how do i get the click to be submitted to the db from a drom down list?

barns101

10:26 am on Aug 7, 2006 (gmt 0)

10+ Year Member



It will need to be submitted to another page as part of a form. The next page can then connect to the database. (Or of course the form can be submitted to the same page and the script can connect to the database ony when $_POST is present).

dave1236

1:38 pm on Aug 7, 2006 (gmt 0)

10+ Year Member



Thanks...here is a snippet of code i am using...i need to get the user name and password in the form somewhere...where/how do i do that?

<select name="schools" id="schools">
<option value="na">Youth Organizations</option>
<option value="supportbigred20">------------------------------------------------------------------------------</option>
<option value="supportbigred301-20">AD&JP Fund</option>
<option value="supportbigred302-20">CYHA</option>
</select>

Here is a form that I use(and it works) to submit text-entered info to my DB...so my drop down action needs to go to Login2006.php and the option value needs to pass both username and password. This is where I run into issues...

<form action="Login2006.php?do=login" method="POST">
<p align="left"><b>Username</b> <input type="text" name="fusername"
size="15" maxsize="20">
<b>Password</b>&nbsp; <input type="password" name="fpassword"
size="15" maxsize="20">
<br>

<input type="submit" name="log"
value="Enter" style="float: left">

jatar_k

2:57 pm on Aug 12, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



the values they entered into the form will be available in the $_POST superglobal array

$_POST['schools'] will be the selection from the drop down

username and password will be in

$_POST['fusername']
$_POST['fpassword']

dave1236

8:23 pm on Aug 17, 2006 (gmt 0)

10+ Year Member



Thanks! I got it to work!
Much appreciated