dreamMyDream2014 2015-11-02 16:30
浏览 42

让php从Mysql自动填充电子邮件地址

I have a working form that allows the user to add invoices to a database, it will then display the invoices in a table, within the table there in a email button within the Name section. When the user clicks the button it will pull up a bootstrap modal that asks for the email, subject, and content. It will then shoot an email address to the entered email address. This is working perfectly, however i would now like it to grab the email address that's associated with the name inside the database.

This is what i've been trying with no success

Home.php

<div class="form-group">
  <label class="col-md-4 control-label" for="email">Email:</label>  
  <div class="col-md-5">
  <input id="email" name="email" type="text" placeholder="placeholder@gmail.com" class="form-control input-md" 
  value="<?php echo $query['email']?>">

   </div>
 </div>

up in my code im connecting o the database like this

        $query = mysql_query("SELECT id, Rep, Date, email, Name, P_O, ADDDATE(Date, Terms) AS Due_Date, Terms, GREATEST(DATEDIFF(NOW(), ADDDATE(Date, Terms)), 0) AS Aging, Open_Balance from Book1");

So what im looking for is when the suer clicks the email button next to the customers Name, it will auto fill the modal with the emailaddress thats in the same ROW as the Name.

  • 写回答

2条回答 默认 最新

  • duanjie6912 2015-11-02 16:44
    关注

    You will need to do $database_array = mysqli_fetch_array($query)then echo $database_array['email'];

    $query = mysql_query("SELECT id, Rep, Date, email, Name, P_O, ADDDATE(Date, Terms) AS Due_Date, Terms, GREATEST(DATEDIFF(NOW(), ADDDATE(Date, Terms)), 0) AS Aging, Open_Balance from Book1");
    
    $database_array = mysqli_fetch_array($query);
    
    <input id="email" name="email" type="text" placeholder="placeholder@gmail.com"     class="form-control input-md" 
    value="<?php echo $database_array['email']?>">
    
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集