Jump to content

How to Auto Assign Value to <Option> Tag ??


scmsimplybest

Recommended Posts

Hello Guys,

 

I m Building A Chat Application..in which i have 2 different user types like Admin & Merchant...I Have Taken User type A for Admin & M for Merchant...First I have Created Only Single LogIn Form for both user types & given DropDown So that If He Selects Merchant then it will assign value M to user type...now i have to create another LogIn form for Merchant...so how can i Auto Assign Value Of user type without displaying it on Form at User Side !! :(

 

I am Providing my Both Codes For LogIn Just Help Me !!

Old Code For Both Admin & Merchant.

<form action="index.php" method="post">
  <table width="350" border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF" class="small_grey_border">
    <tr>
      <td width="346"><div align="center"><strong><font size="5">       
      Login</font></strong></div></td>
    </tr>
    <tr>
      <td>	  <div align="center">
          <p><font color="#FF0000" face="Tahoma"><strong> <?php echo $login_message; ?> 
            </strong></font></p>
          <table width="332" border="0" cellspacing="0" cellpadding="2">
            <tr>
              <td width="126" nowrap><div align="right">Username:</div></td>
              <td width="148" nowrap><font face="verdana" size="2"><b>
                <input name="user" class="input" maxlength="100">              
              </b></font></td>
            </tr>
            <tr>
              <td><div align="right">Password:</div></td>
              <td><font face="verdana" size="2"><b>
                <input name="pass" type="password" class="input" maxlength=20>
              </b></font></td>
            </tr>
             <tr>
              <td><div align="right">Are you Merchant?:</div></td>
              <td><font face="verdana" size="2"><b><select name="usertype"><option value="A">No</option><option value="M">Yes</option></select>
               
              </b></font></td>
            </tr>
            <tr>
              <td colspan="2"><div align="center"><font face="verdana" size="2"><b>
                  <input type="submit" value="Login" name="sublogin" class="input">
              </b></font></div></td>
            </tr>
          </table>
          </div>
  </td>
    </tr>
  </table>
</form>

 

New Code For Merchant.

<form action="index.php" method="post">
  <table width="350" border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF" class="small_grey_border">
    <tr>
      <td width="346"><div align="center"><strong><font size="5">       
      Merchant Login</font></strong></div></td>
    </tr>
    <tr>
      <td>	  <div align="center">
          <p><font color="#FF0000" face="Tahoma"><strong> <?php echo $login_message; ?> 
            </strong></font></p>
          <table width="332" border="0" cellspacing="0" cellpadding="2">
            <tr>
              <td width="126" nowrap><div align="right">Username:</div></td>
              <td width="148" nowrap><font face="verdana" size="2"><b>
                <input name="user" class="input" maxlength="100">              
              </b></font></td>
            </tr>
            <tr>
              <td><div align="right">Password:</div></td>
              <td><font face="verdana" size="2"><b>
                <input name="pass" type="password" class="input" maxlength=20>
              </b></font></td>
            </tr>
             <tr>
              <td><div align="right">Are you Merchant?:</div></td>
              <td><font face="verdana" size="2"><b><select name="usertype" ><option value="M">Yes</option></select>
                            
              </b></font></td>
            </tr>
            <tr>
              <td colspan="2"><div align="center"><font face="verdana" size="2"><b>
                  <input type="submit" value="Login" name="sublogin" class="input">
              </b></font></div></td>
            </tr>
          </table>
          </div>
  </td>
    </tr>
  </table>
</form>

Link to comment
https://forums.phpfreaks.com/topic/191045-how-to-auto-assign-value-to-tag/
Share on other sites

<input type="hidden" name="My_data" value="YOURDATAWILLBETHISSTRING">

Have something like, for a quick dirty way of doing it. If you don't want to pass it along another way.

This create a hidden input type you can still send the value of too the php script. If you want it so they can't tell what it is by looking in the view source of the page then just do some crypt script to the string and display that as the value and then decrypt it later.

 

Not sure if that is what you were looking for

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.