Web Design Forum: update mysql via a drop down - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

update mysql via a drop down Rate Topic: -----

#1 User is offline   lukey 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 01-February 12
  • Reputation: 0

Posted 02 February 2012 - 02:25 AM

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
0

#2 User is online   sash_oo7 

  • Forum Newcomer
  • PipPipPipPip
  • Group: Members
  • Posts: 838
  • Joined: 15-August 10
  • Reputation: 45
  • Gender:Male
  • Location:Mars
  • Experience:Nothing
  • Area of Expertise:Nothing

Posted 02 February 2012 - 03:29 AM

View Postlukey, 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



something like this?
or this

u can use ajax too

This post has been edited by sash_oo7: 02 February 2012 - 04:23 AM

0

#3 User is offline   lukey 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 01-February 12
  • Reputation: 0

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??
0

#4 User is online   sash_oo7 

  • Forum Newcomer
  • PipPipPipPip
  • Group: Members
  • Posts: 838
  • Joined: 15-August 10
  • Reputation: 45
  • Gender:Male
  • Location:Mars
  • Experience:Nothing
  • Area of Expertise:Nothing

Posted 02 February 2012 - 09:54 PM

can u explain in more detail with images what exactly r u trying to achieve
0

#5 User is offline   lukey 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 01-February 12
  • Reputation: 0

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:

// 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;

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users