我有以下表单字段:重复用户的电子邮件输入字段为用户名字段(剥离一切,包括和之后“@”)
<label for="user_email"><?php _e('Your Email'); ?>: </label>
<input type="text" name="user_email" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" id="user_email" class="required email" tabindex="102" />
<label for="user_login"><?php _e('Username'); ?>: </label>
<input type="text" name="user_login" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" id="user_login" tabindex="101" class="required" />
有没有什么办法让USER_LOGIN字段从实时填充输入到user_email(理想情况下是字母,如果没有,在不重点之后),在@符号之前停止,以便当用户将“[email protected]”填入user_email字段时,user_login字段将自动填入“example “?
我想最终将用户名字段设置为隐藏,但希望看到它是否首先可见。
如果你使它隐藏那么不能两个人有相同的用户名? [email protected]和[email protected] – Timm 2012-08-15 10:37:35
http://www.php.net/manual/en/function.explode.php – 2012-08-15 10:41:05
@Tim是对的。我不认为隐藏该领域是一个好主意,请参阅我的答案了解详情。 – 2012-08-15 10:47:23