javascript만으로 폼전송
############# frm_test.html #############
<script type="text/javascript">
function createForm(frm_name,frm_method,frm_action,frm_target) {
var f=document.createElement("form");
f.name=frm_name;
f.method=frm_method;
f.action=frm_action;
f.target=frm_target;
return f;
}
function addHidden(f,input_type,input_name,input_id,input_value) {
var i=document.createElement("input");
i.type=input_type;
i.name=input_name;
i.id=input_id;
i.value=input_value;
f.insertBefore(i);
return f;
}
var frm=createForm("frm_test", "post", "frm_test.php", "");
frm=addHidden(frm, "hidden", "mode", "mode", "login");
frm=addHidden(frm, "hidden", "id", "id", "duellist");
frm=addHidden(frm, "hidden", "password", "password", "1234");
document.insertBefore(frm);
frm.submit();
</script>
################## frm_test.php ##################
<?
echo "mode : ".$_POST['mode']."<br>";
echo "id : ".$_POST['id']."<br>";
echo "password : ".$_POST['password']."<br>";
?>
################## 출력결과 ##################
mode : login
id : duellist
password : 1234