form에 action값 어떻게 줘야 할까요?
본문
안녕하세요 궁금한 점이 있어 질문올립니다.
form에서 버튼 클릭 후 페이지 이동을 하면
number_change.php?w=u&bo_table=Profile_board&insert_num=9&wr_id=112
위와 같은 경로로 이동을 해야하는데 테이블 이랑 id값을 못받고
number_change.php?insert_num=9
이런식으로 페이지 이동이 됩니다.
form은
<form name="change" action="number_change.php" >
번호 <input class="ed" size=5 name="insert_num" value=''> 앞으로 이동
<input type="submit" value="변경">
</form>
이렇게 구성 되어있는데 action에 값을 어떻게 줘야
테이블과 id값을 받고 페이지 이동을 할수 있을까요?
답변 5
리스트는 wr_id가 여러개이니 어느 게시물을 이동할 것인지 정하는 방법이 있어야할테죠
15개의 게시물 중 10번 게시물을 이동하겠다고 하면 10번 게시물 wr_id를 폼에 넣는 방법이 있어야겟죠
폼은 아래와 같이 구성
<form name="change" action="number_change.php" >
<input type='hidden' name='w' value='u'>
<input type='hidden' name='bo_table' value='<?=$bo_table?>'>
이동할 wr_id : <input type='text' name='wr_id' value=''>
번호 <input class="ed" size=5 name="insert_num" value=''> 앞으로 이동
<input type="submit" value="변경">
</form>
게시물마다 적당한 위치에 아래와 같이 버튼을 넣습니다
<a href="javascript:document.forms.change.wr_id.value='<?=$list[$i][wr_id]?>';">이동</a>
이제 클릭하면 wr_id가 등록 될 것입니다
이동하고 싶은 위치만 입력하면 되겠군요
form 안에 전체소스를 올리세요
저폼안에다가도 인풋 히든으로 값들을 넣으면 될거 같은뎀..
폼으로 get값을 전송하려면
<input type='text' name='aaa' value='a'/>
<input type='text' name='bbb' value='bb'/>
위처럼 보내려는 모든 정보를 form안에 input 으로 넣으세요
저도 평소에 궁금해 하던거에요~ ^^;
답변을 작성하시기 전에 로그인 해주세요.