i am looking to use a drop down menu on my webpage. When a user selects a value from the drop down menu it will update in mysql.
has anyone got any code for this
Page 1 of 1
update mysql via a drop down
#2
Posted 02 February 2012 - 03:29 AM
lukey, on 02 February 2012 - 02:25 AM, said:
i am looking to use a drop down menu on my webpage. When a user selects a value from the drop down menu it will update in mysql.
has anyone got any code for this
has anyone got any code for this
something like this?
or this
u can use ajax too
This post has been edited by sash_oo7: 02 February 2012 - 04:23 AM
#3
Posted 02 February 2012 - 02:41 PM
thanks for your reply.
How do I add multiple colours under the 'colour' field in the mysql databse to create this drop down menu on my page??
How do I add multiple colours under the 'colour' field in the mysql databse to create this drop down menu on my page??
#4
Posted 02 February 2012 - 09:54 PM
can u explain in more detail with images what exactly r u trying to achieve
#5
Posted 04 February 2012 - 01:33 AM
I have a better idea which I think is easier.
I have a login system which works fine but the next step I want to do is redirect each user depending on their medals they have, which is either 1, 2, 3, 4 or 5. In the mysql database I have a field called medals which is pre filled in for each username and password to 1 of the 5 amounts.
so lets say a user with 1 medal logs in i want it to go to location 'page1.html'
if a user with 2 medals logs in i want it to go to location 'page2.html'
if a user with 3 medals logs in i want it to go to location 'page3.html' and so on.
I have tried the following code but it does not redirect successfully:
I have a login system which works fine but the next step I want to do is redirect each user depending on their medals they have, which is either 1, 2, 3, 4 or 5. In the mysql database I have a field called medals which is pre filled in for each username and password to 1 of the 5 amounts.
so lets say a user with 1 medal logs in i want it to go to location 'page1.html'
if a user with 2 medals logs in i want it to go to location 'page2.html'
if a user with 3 medals logs in i want it to go to location 'page3.html' and so on.
I have tried the following code but it does not redirect successfully:
// Check username and password match
if (mysql_num_rows($login) == 1) {
// Set username session variable
$_SESSION['username'] = $_POST['username'];
// Jump to secured page
$row = mysql_fetch_row($sql);
switch ($row['medals']):
case 1:
header('location: page1.html');
exit;
case 2:
header('location: page2.html');
exit;
case 3:
header('location: page3.html');
exit;
case 4:
header('location: page4.html');
exit;
case 5:
header('location: page5.html');
exit;
Share this topic:
Page 1 of 1
Help















