Member Avatar for JayGeePee

Alright here we go... I just purchased a Javascript/css based login form that works very similar to twitters login form. Here lies the problem. The way my website works is this...Theres a login link you click on that takes you to the login page. Because my site is set up for buyers and sellers I have two login forms on the same page. I was wondering how I could allow both kinds members to login from the new login form I just purchased. How could I code a buyer check box, and provider check box into the same login form? Is it possible? I'd like the option for both members to sign in from the same form with the option to click either the buyer or seller box - Which ever they signed up for.

I suppose you could simply include a couple of radio buttons:

<input type="radio" name="member" value="buyer" checked="checked"/>Buyer
<input type="radio" name="member" value="seller"/>Seller

(OR a select list with the two options).

After adding the HTML code as stated by heilo, you may need to go into the code you purchased and modify the code to check which radio had been selected. ex:

//if your code is in php

if(isset($_POST['member'])=='buyer'){
     //verify login and login as buyer
}
else if(isset($_POST['member'])=='seller'){
    //verify login and login as seller
}else{
    //show error
}
Member Avatar for P0lT10n

After adding the HTML code as stated by heilo, you may need to go into the code you purchased and modify the code to check which radio had been selected. ex:

//if your code is in php

if(isset($_POST['member'])=='buyer'){
     //verify login and login as buyer
}
else if(isset($_POST['member'])=='seller'){
    //verify login and login as seller
}else{
    //show error
}

You are right but don use if, else if, else... use switch, is more efficient, faster and easier to think...

With switch would be:

switch($_POST['member']){
     case 'buyer':
          // verify login and login as buyer
     break;
     case 'seller':
          // verify login and login as seller
     break;
     default:
          // Show error
     break;
}

You are right but don use if, else if, else... use switch, is more efficient, faster and easier to think...

With switch would be:

switch($_POST['member']){
     case 'buyer':
          // verify login and login as buyer
     break;
     case 'seller':
          // verify login and login as seller
     break;
     default:
          // Show error
     break;
}

and it's also more readable.

Member Avatar for P0lT10n

yes sure, that's why i love switch... If we solved your problem, tick it as solved...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.