form태그에서 get으로 변수를 두개의 파일에 보낼수 있나여?

hakbini의 이미지

한 화면에 프레임을 3개로 나눴습니다. 그 중의 한군데서 밑에 소스처럼 폼태그를 이용해서 get으로 변수를 나머지 2개의 파일에 보낼려고 합니다.
지금처럼 작성을 하게 되면 abc.php에 $test라는 변수값을 보낼수 있는 것으로 알고 있는데 혹시 하나의 form태그를 이용해서 두개의 파일에다가 같은 변수값을 어떤 방식으로 보낼수 있을까요?

<form method=get action="abc.php" target="detail">
<select name="test" size="1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</form>

혹시 아시는 님들 조언좀 부탁드립니다~
좋은 하루 되세여~^^

hongminhee의 이미지

JavaScript를 이용하지 않고는 힘들 듯하네요. 아래는 당장 가장 쉽게 떠오르는 복잡한 방법.

formElement.onsubmit = function() {
    var another {'action': 'def.php', 'target': 'another_frame'};
    var tmp = {'event': this.onsubmit, 'action': this.action, 'target': this.target};

    this.action = another.action;
    this.target = another.target;
    this.onsubmit = function() {};
    this.submit();

    this.action = tmp.action;
    this.target = tmp.target;
    this.onsubmit = tmp.event;
};

많이 복잡하네요.
lovian의 이미지

저게 가능한가요?

첫번째 submit이 되는 순간 another.action 페이지로 이동할것이니 뒤의 tmp.action에 대한 것들은 실행이 되지 않을 것으로 보입니다.

역시 대안이란 ajax?

-----------------
한글을 사랑합니다.

익명 사용자의 이미지

lovian wrote:
저게 가능한가요?

첫번째 submit이 되는 순간 another.action 페이지로 이동할것이니 뒤의 tmp.action에 대한 것들은 실행이 되지 않을 것으로 보입니다.

역시 대안이란 ajax?

더미 프레임을 한개 더만들어 두고 각각 타겟을 주어서 날리면 되죠...가능합니다.

hakbini의 이미지

답변 정말 감사 합니다.
갑자기 생각난건데 하나의 폼태그를 이용하고 버튼을 두 개 만들어서 첫번째 버튼을 누르면 get으로 변수를 해당 파일에 보내고, 다른 나머지 버튼을 누르면 변수를 다른 파일에 보내게 하는 것은 가능한가여?

hongminhee의 이미지

lovian wrote:
저게 가능한가요?

첫번째 submit이 되는 순간 another.action 페이지로 이동할것이니 뒤의 tmp.action에 대한 것들은 실행이 되지 않을 것으로 보입니다.


another.target 프레임이 another.action 페이지로 이동하고, 현재 프레임은 이동하지 않으니, 가능할 것 같은데요?
평양선봉의 이미지

hakbini wrote:
답변 정말 감사 합니다.
갑자기 생각난건데 하나의 폼태그를 이용하고 버튼을 두 개 만들어서 첫번째 버튼을 누르면 get으로 변수를 해당 파일에 보내고, 다른 나머지 버튼을 누르면 변수를 다른 파일에 보내게 하는 것은 가능한가여?

폼의 액션속성을 주지 않고..
버튼을 눌렀을때 액션 지정을 해주면.. 가능합니다.
타겟도 마찬가지고요..

ajax의.. 강점은.. 프레임으로 왔다갔다 안해도 되니 간편하네요.. 8)

----
웹페이지 : http://bzpalm.net/

lovethecorners의 이미지

hakbini wrote:
답변 정말 감사 합니다.
갑자기 생각난건데 하나의 폼태그를 이용하고 버튼을 두 개 만들어서 첫번째 버튼을 누르면 get으로 변수를 해당 파일에 보내고, 다른 나머지 버튼을 누르면 변수를 다른 파일에 보내게 하는 것은 가능한가여?

function submit(nMode){ 
    if(nMode == "first"){ 
         frm.action="aaa.php"; 
         frm.submit(); 
    } 
    if(nMode == "seceond"){ 
         frm.action="bbb.php"; 
         frm.submit(); 
    } 
} 

이런식으로 하면 되지 안을까요?

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.