2010-12-27 4 views
0

각 제출 버튼마다 다른 작업을 수행하려고합니다. 예를 들어서 compare는 "compare.php"로 가고 delete는 "test.php"로 갈 것입니다. 양식 안에 양식을 만들 수는 없지만 하나의 표이기 때문에 두 가지 양식으로 구분할 수는 없습니다. 내 생각 엔양식> 표 (아약스)> 양식

<?php if(isset($_POST["com"])){ javascript - link to compare.php}?> 

이 페이지에 _POST를 보내려면 어떻게해야합니까? 은 .. 나는 또한 _GET으로 공업을 보낼에 생각하지만, 사용자가 두 개 이상의 (이 삭제 또는 두 개의 비교) 물론 다른 솔루션이있는 경우를 선택할 수 있습니다

<html> 
<head> 
<script> 
build ajax tbody... 
for (i = 1; i <= numOfRows; i++) 
{ 
oCell = oRow.insertCell(-1); 
oCell.innerHTML = "<input type='checkbox' value='"+ ind + "'name='com[]'>"; 
oCell = oRow.insertCell(-1); 
oCell.innerHTML = "<input type='checkbox' value='"+ ind + "'name='del[]' ;>"; 
..... 
</script> 
<body> 
    <form method="post" action="test.php"> 
     <table> 
      <thead> 
      <tr> 
       <th><input type="submit" value="Compare" /></th> 
       <th><input type="submit" value="Delete" /></th> 
      </tr> 
      </thead> 
      <tbody></tdbody> 
     </table> 
    </form> 
</body> 
</html> 

감사합니다!

답변

0

당신은 간단하게 할 수 있습니다 :

<input type="submit" value="Compare" onclick="this.form.action = 'someotherpage.php';" /> 

이가 제출 버튼을 클릭시 형태의 동작을 변경합니다.

+0

와우 !!! 정말 쉽게 ... 고마워요! – Ronny

+0

@ 로니 아무 문제 없어! :) –

+0

니스, 당신은' Piskvor