使用参数从html表单调用PHP函数

时间:2016-02-03 13:33:16

标签: php jquery html

我正在尝试从HTML表单中对数据库运行一个简单的选择

HTML代码段

<form Name ="form1" Method ="post" ACTION = "get341Usage.php">

<input type="submit" name="Submit1" value="3 Months" >

</form>

PHP文件get341Usage.php

<?php
function get341Usage($org_id,$usage_mnth ) {

  $conn = oci_connect('user', 'pass', '//server/ora_instance');

  $query = "SELECT usage.* from usage_table usage 
  where customer_number            = ' . $cust_id . '
  AND usage_date >= (select add_months(sysdate ,' . $usage_mnth . '))";

  $stid = oci_parse($conn, $qryStr);
  oci_execute($stid);


  oci_free_statement($stid);


}

if(isset($_POST['submit']))
{
    getUsage($org_id,$usage_mnth);
} 

?>

2个参数的原因是我想创建3个按钮3,6,12 monnths,用户点击它并提示自动将数据保存到csv文件(甚至还没到这个pary呢! )

任何一点都会很棒......我怀疑我离我很远了

1 个答案:

答案 0 :(得分:-1)

if(isset($_POST['Submit1']))
{
    getUsage($org_id,$usage_mnth);
}