douou9094747 2015-06-30 09:28
浏览 84
已采纳

将隐藏的HTML表单输入发送到PHP

I have been working on this for hours, and I haven't been able to get it right.

I am using jquery to pull <address> from an xml file. From there, I am using it to set that value to that of the hidden input. And from there, I would like to send the hmtl data to the .php file. I have tried everything I can think of and now it's 5:23AM.

Here is my HTML <input type="hidden" id="SenatorAddress" name="SA" />

Here is the JS: `

     {

        $('#StateSelect').change(function(){
            $('#SenatorSelect').empty();
            var state = $(this).val();
            var select1 = $('#SenatorSelect');
            var SAD = $('#SenatorAddress');
            select1.append('<option value="Select a senator">Select a Senator</option>');
        $(xml).find('member').each(function(){
            if(state == $(this).find('state').text()){
            var fname = $(this).find('first_name').text();
            var lname = $(this).find('last_name').text();
            select1.append("<option>"+fname+"&nbsp"+lname+"</option>");
            var sadress = $(this).find('address').text();
             SAD.append(Sadress);
        }

Here is the PHP:

The Honorable <?php echo $_GET["senatornames"]; ?><br>
<?php echo $_GET["SA"]; ?><br>
United States Senate<br />
Washington, DC 20510<br />
  • 写回答

1条回答 默认 最新

  • douqiao7188 2015-06-30 09:43
    关注

    Use SAD.val(sadress) instead of SAD.append(Sadress);

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog