|
|
|
19년 전
|
조회 2,534
|
|
|
|
19년 전
|
조회 1,646
|
|
|
|
19년 전
|
조회 1,681
|
|
|
|
19년 전
|
조회 1,574
|
|
|
|
19년 전
|
조회 1,555
|
|
|
|
19년 전
|
조회 1,563
|
|
|
|
19년 전
|
조회 1,568
|
|
|
|
19년 전
|
조회 1,474
|
|
|
|
19년 전
|
조회 1,612
|
|
|
|
19년 전
|
조회 1,550
|
|
|
|
19년 전
|
조회 1,704
|
|
|
|
19년 전
|
조회 1,597
|
|
|
|
19년 전
|
조회 1,565
|
|
|
|
19년 전
|
조회 1,812
|
|
|
|
19년 전
|
조회 1,699
|
|
|
|
19년 전
|
조회 1,554
|
|
|
|
19년 전
|
조회 1,694
|
|
|
|
19년 전
|
조회 1,511
|
|
|
|
19년 전
|
조회 1,588
|
|
|
|
19년 전
|
조회 1,669
|
댓글 17개
일단 한 곳으로 보내고,
그곳에서 자동으로 또 다른 곳으로 보내는 방법이 일반적인 것 같습니다.
아니면 업데이트에서 쿼리문을 또하나 실행해야 할것같은데요
1. 하나의 폼에서 두 곳으로 보내려면 어떻게 해야 할까요?
==>> db table 2곳에 삽입하는거라면.. ( 일반적으로 이거거둥요 )
예) update_db2.php
$sql = " insert into g4_write_table1....생략";
sql_query($sql);
//생략
$sql = " insert into g4_write_table2....생략";
sql_query($sql);
이런식으로 2개의 테이블에 삽입하는 방식으로 하는데요.. ^^
결과는 2곳에 삽입한거죠. ^^
2. 혹은 하나의 폼에서 한쪽으로 보내고 한쪽에서 또 다른 곳으로 보내는 방법이라든지... ^^
==>> 같은 내용여요. >>..<<
섹션을 쓰세요. ^^ 설명 복잡.. ^^
이 부분에서는 생소해서 어렵네요. ㅡ.ㅡa
var req = create_request();
function create_request() {
var request = null;
try {
request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
request = new ActiveXObject("Msxml12.XMLHTTP");
} catch (othermicrosoft) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = null;
}
}
}
if (request == null)
alert("Error creating request object!");
else
return request;
}
function send() {
var val = document.getElementById("name");
var val2 = document.getElementById("option");
send = "name=" + val;
send = "&option=" + val2;
req.open("POST", "update.php", true);
req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
req.send(send);
req.open("POST", "update2.php", true);
req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
req.send(send);
req.open("POST", "update3.php", true);
req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
req.send(send);
}
</script>
<form name="form" method="post">
<input type=text size=10 name=name value='곱슬최씨'>
<input type=text size=10 name=option value='천재'>
<input type=button value=전송 onclick=send()>
</form>
좀더 내공을 높여 써먹어야겠어요 ^^
더 좋은 방법이 있을거 같은데 전 그냥 foreach문을 사용했습니다.
[test.php]
<form name="form1" method="post" action="test2.php">
<input type="text" name="name1" value="카르마">
<input type="text" name="nic1" value="장동건">
<input type="submit" value="Submit">
</form>
[test2.php]
<?php
if ($_POST) {
echo "test2.php<hr>";
foreach($_POST as $key=>$val) {
echo "$key => $val<br>";
}
$form = "<form name='form2' method='post' action='test3.php'>";
foreach($_POST as $key=>$val) {
$form .= "<input type='hidden' name='$key' value='$val'>";
}
$form .= "</form>";
$form .= "<script type='text/javascript'>if (confirm('test3.php로 폼값을 넘길까요?')) { form2.submit(); }</script>";
echo $form;
}
?>
[test3.php]
<?php
echo "test3.php<hr>";
foreach($_POST as $key=>$val) {
echo "$key => $val<br>";
}
?>