简体   繁体   中英

Combine two inputs into one form

I am trying to add a feature to my application and it has a sign in. How would I combine the user inputs so there is one account rather than two?

Here is the application:

<input type="text" class="login_txt" name="user_name" id="login_userName" title="Username" value="<?php echo $_GET['user_name'];?>" tabindex="1"/>
  <span class="hide"></span> </li>

<li>
  <?php if ($_GET['email']) { ?><input type="hidden" id="userEmail" /><?php } ?>
  <input type="text" class="login_txt" id="login_account" title="Account (email)" name="email" value="<?php echo $_GET['email']; ?>" tabindex="2" />
  <span class="hide"></span> </li>

<li>
  <input type="text" class="login_txt" id="login_password_txt" tabindex="3" title="Password" value="Password"/>
  <input type="password" name="password" title="Password" id="login_password" class="login_txt tny-hide">
  <span class="hide"></span> </li>

<li<?php if ($this->fromuid || $this->icode || (get_setting('register_seccode') == 'N')) { ?> style="display:none;"<?php } ?>>
  <input type="text" class="login_txt auth_code" id="authCode" name="seccode_verify" title="Verification code" value="Verification code" tabindex="4" />
  <em class="auth_img"><img src="" onclick="this.src = GET_BASE_URL + '/account/captcha/rnd-' + Math.floor(Math.random() * 10000);" id="seccode" /></em> <span class="hide"></span> </li>

<li id="global_err" class="tny-hide">
  <p class="global-err tny-small tny-err_bg"><em class="e"></em><span id="glo_Err">Account number or password is incorrect, please try again</span></p>
</li>

<li class="user_treaty">
  <input type="checkbox" name="agreement_chk" value="agree" id="user_agreement" checked="true"/>
  &nbsp;&nbsp;
  <label for="user_agreement">I agree <a href="javascript:;" onClick="$.register.s.EveClick();">User agreement</a> terms</label>
  <div class="usertt reg_treaty_bg rel tny-hide" id="user_agre"><span class="reg_arrows abs tny-small"></span><div class="txt" id="register_agreement">Loading......</div></div>
</li>

<li><a href="javascript:;" class="login_sub tny-cl_06 tny-fb_14 tny-right" title="Register now" tabindex="5"  onClick="$.register.reg.register().callback(function () { aj


Here's the polling system:

<?php if (!empty($this->config["logo"])): ?>
      <a href="<?php echo $this->config["url"] ?>"><img src="<?php echo $this->config["url"] ?>/static/<?php echo $this->config["logo"] ?>" alt="<?php echo $this->config["title"] ?>"></a>
    <?php else: ?>
      <h3><a href="<?php echo $this->config["url"] ?>"><?php echo $this->config["title"] ?></a></h3>
    <?php endif ?>
  </div> 

  <?php echo Main::message() ?>
  <form role="form" class="live_form form" id="login_form" method="post" action="<?php echo Main::href("index.php?a=user/login","user/login")?>">
    <div class="form-group">
      <label for="email"><?php echo e("Email address")?> 
        <?php if($this->config["users"]): ?>
          <a href="<?php echo Main::href("index.php?a=user/register","user/register")?>" class="pull-right">(<?php echo e("Create account")?>)</a>
        <?php endif ?>
      </label>
      <input type="email" class="form-control" id="email" placeholder="Enter email" name="email">
    </div>
    <div class="form-group">
      <label for="pass"><?php echo e("Password")?> <a href="#forgot" class="pull-right" id="forgot-password">(<?php echo e("Forgot Password")?>)</a></label>
      <input type="password" class="form-control" id="pass" placeholder="Password" name="password">
    </div>         
    <div class="form-group">
      <label>
          <input type="checkbox" name="rememberme" value="1" data-class="blue">  
          <span class="check-box"><?php echo e("Remember me")?></span>
      </label>
    </div>                  
    <?php echo Main::csrf_token(TRUE) ?>
    <button type="submit" class="btn btn-primary"><?php echo e("Login")?></button>
  </form>  

  <form role="form" class="live_form" id="forgot_form" method="post" action="<?php echo Main::href("index.php?a=user/forgot","user/forgot")?>">
    <div class="form-group">
      <label for="email1"><?php echo e("Email address")?></label>
      <input type="email" class="form-control" id="email1" placeholder="Enter email" name="email">
    </div>        
    <?php echo Main::csrf_token(TRUE) ?>
    <button type="submit" class="btn btn-primary"><?php echo e("Reset Password")?></button>
    <a href="<?php echo Main::href("user/login") ?>" class="pull-right">(<?php echo e("Back to login")?>)</a>
  </form>        
    </div>

Your question is unclear, however I'm under the impression you wish to combine two variables.

You can combine variables by concatenating them.

For example:

<?php

$var1 = "Var 1";
$var2 = "Var 2";

$var_all = $var1 . " " .$var2;

echo $var_all;

Will echo Var 1 Var 2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM