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 C++ 如何判断设置快捷键来实现隐藏/显示窗口
  • ¥15 关于#材料工程#的问题:有没有具有电子阻挡层和空穴阻挡层的电池仿真silvaco代码例子或者其他器件具有阻挡层例子的silvaco代码(最好还有相关文献)
  • ¥60 基于MATLAB的TAOD算法
  • ¥15 Groimp使用疑问
  • ¥15 MDK–ARM里一直找不到调试器
  • ¥15 oracle中sql查询问题
  • ¥15 vue使用gojs3.0版本,在nodeDataArray中的iconSrc使用gif本地路径,展示出来后动画是静态的,不是动态的
  • ¥100 代写个MATLAB代码,有偿
  • ¥15 ansys electronics 2021 R1安装报错,错误代码2,如图
  • ¥15 Dev-c++打字不出现中文,但出现日文