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 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)