我正在尝试将隐藏变量发送到 php 文件。由于某些原因,php 不接收这些变量。下面是旨在发送这些变量的代码。关于为什么它不起作用的任何想法?谢谢你的帮助。
////// For the form of training data
// bind 'myForm1' and provide a simple callback function
$('.myForm1').ajaxForm(options);
// attach handler to form's submit event
$('.myForm1').submit(function() { // .myForm1 is a class so applies to all forms of this page
// passing PK/FK as hidden value to php (drop down menu displays values, here I get the PK-PF via key and send them to php for upload)
var sown=$('#selpersonO').find(":selected").attr('key'); // finds the value of key of the selected choice in the drop down menu. Key is sent back by the php code that send info to drop down menu
//console.log(tmp);
//console.log(this);
$(this).append('<input/>').attr('type','hidden').attr('selpersonO',sown); // makes key value as hidden and passed to the php form that uploads data
//console.log( $('.myForm')) ;
var saccess=$('#selaccess').find(":selected").attr('key');
$(this).append('<input/>').attr('type','hidden').attr('selaccess',saccess);
var scountry=$('#selcountry').find(":selected").attr('key');
$(this).append('<input/>').attr('type','hidden').attr('selcountry',scountry);
var sprod=$('#selpersonP').find(":selected").attr('key');
$(this).append('<input/>').attr('type','hidden').attr('selpersonP',sprod);
// submit $the form
$(this).ajaxSubmit();
// return false to prevent normal browser submit and page navigation
return false;
});