如何在表2的下拉列表中显示表1的值 [英] How to display the value of table 1 in drop down list of table 2

查看:93
本文介绍了如何在表2的下拉列表中显示表1的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是一名新学员。我有两个表:登录和充值相同的数据库注册。



登录表有名称,地址和移动作为一行和充值表有移动和金额连续。我想要登录表的移动号码列表应该显示为充值表的移动行中的下拉选择列表,这样我就不应该重新输入作为文本输入。有人请帮帮我。



我尝试过:



Hi,

I am a new learner. I have two tables: login and recharge of same database "registration".

"login" table has name, address and mobile as a row and "recharge" table has mobile and amount as a row. I want mobile number list of "login" table should display as a drop down select list in mobile row of "recharge table so that i should not retype as text input. Someone please help me out .

What I have tried:

<?php
 error_reporting('E_ALL ^ E_NOTICE');
 if(isset($_POST['submit']))
 {
  mysql_connect('localhost','root','') or die(mysql_error());
  mysql_select_db('registration') or die(mysql_error());
  
$reg1=$_POST['reg1'];
$date=$_POST['date'];
$mobile=$_POST['mobile'];
$amt=$_POST['amt'];
$pbal=$_POST['pbal'];
$cbal=$_POST['cbal'];

$q=mysql_query("select * from recharge where reg1='".$reg1."'or date='".$date."'  or mobile='".$mobile."'
or amt='".$amt."'or pbal='".$pbal."'or cbal='".$cbal."'") or die(mysql_error());
  

   
$insert=mysql_query("insert into recharge values('".$reg1."','".$date."','".$mobile."','".$amt."','".$pbal."','".$cbal."')") or die(mysql_error());
   
if($insert)
   
{
    $er='Registered successfully';
  
 }
   else
   {

    $er='Not Registered';

   }
  

 }

?>
<div class="contact">

<h1>REGISTRATION FORM</h1>
<div id="er"><?php echo $er; ?></div>
<table width="963" align="center" id="tbl"><tbody><tr><td width="224"> REGISTRATION NUMBER :</td><td width="252"></td><td width="224"> DATE :</td><td>
  
  $(function() {
    $( "#datepicker" ).datepicker();


  });
  
</td></tr><tr><td> MOBILE NUMBER :</td><td></td><td>STOCK RECHARGE AMOUNT : </td><td></td></tr><tr><td> PREVIOUS BALANCE :</td><td></td><td> CURRENT BALANCE : </td><td></td></tr><tr><td></td><td></td></tr></tbody></table>
     
</div>

推荐答案

_POST [' submit']))
{
mysql_connect(' localhost'' root'' ' die( mysql_error());
mysql_select_db(' registration' die(mysql_error());
_POST['submit'])) { mysql_connect('localhost','root','') or die(mysql_error()); mysql_select_db('registration') or die(mysql_error());


reg1 =


_POST [' reg1'];
_POST['reg1'];


这篇关于如何在表2的下拉列表中显示表1的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆