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 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大