form에 action값 어떻게 줘야 할까요?

form에 action값 어떻게 줘야 할까요?

QA

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 안에 전체소스를 올리세요

list.skin.php 파일 소스 입니다.

<table width="<?=$width?>" align="left" cellpadding="0" cellspcing="0"><tr><td>

<table width="100%" cellspacing="0" cellpadding="0"><tr><td height="4"></td></tr></table>

<form name="change" method="post "action="number_change.php?" >
번호 <input class="ed" size=5 name="insert_num" value=''> 앞으로 이동
<input type="submit" value="변경">
</form>

<table width="100%" cellspacing="0" cellpadding="0" border=0>
<form name="fboardlist" method="post">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="sfl"  value="<?=$sfl?>">
<input type="hidden" name="stx"  value="<?=$stx?>">
<input type="hidden" name="spt"  value="<?=$spt?>">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="sw"  value="">

<? if ($is_admin) { ?><tr><td style="padding-bottom:20px;"height=30 colspan='<?=$board[bo_gallery_cols]?>'><INPUT onclick="if (this.checked) all_checked(true); else all_checked(false);" type=checkbox> 전체선택</td></tr><? } ?>
<tr>
<tr>
<td style="font-weight:bold; font-size:14px; width:20px;">번호</td>
</tr>
<?
for ($i=0; $i<count($list); $i++)
{
$homepageurl="";
//추가
if($list[$i][wr_1] >= 100)
{
$ing="[작업완료]";
//$homepageurl=$list[wr_link1];
if($list[$i][wr_link1]) $homepageurl="<a href='".$list[$i][wr_link1]."' target=_blank>";
}
else $ing="";
   
$_datetime=$list[$i][datetime2];
    $_hit=$list[$i][wr_hit];
    $title = "클릭하시면 해당 사이트로 이동합니다.";
    $content = cut_str(get_text($list[$i][wr_content]), 80);
    $img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);
    if (!file_exists($img) || !$list[$i][file][0][file])
        $img = "$board_skin_path/img/progress/no_image.gif";
    $href = "$g4[bbs_path]/view.skin.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}&no=1";
    //$view_href = "";
    //if ($is_admin)
        $view_href = "<a href='./write.php?w=u&bo_table=$bo_table&wr_id={$list[$i][wr_id]}'</a>";

    $checkbox = "";
    if ($is_checkbox)
        $checkbox = "<input type=checkbox name=chk_wr_id[] value='{$list[$i][wr_id]}' onclick='getRadioValue(this)'>";

$link = cut_str($list[$i][wr_link1], 70);
$homepageurl="<a href='{$list[$i][wr_link1]}' target=_blank>{$link}</a>";
$homepageurl2="<a href='{$list[$i][wr_link1]}' target=_blank>";
$wr_guide = nl2br(cut_str($list[$i][wr_3],250));

    $tr = "";
    if ($i && $i%$board[bo_gallery_cols]==0)
        $tr = "</tr><tr>";
    echo "$tr";

echo <<<HEREDOC

<td width="{$td_width}%" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
<td style="width:30px;font-weight:bold; font-size:14px;">{$list[$i][num]}</td>
        <td>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-left:15px; ">
                <tr>
                    <td width="210" style="vertical-align:top;">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="170" height="128">{$view_href}<img src="{$img}" width="192" height="128"  border="0" style="border:1px solid #ccc;"></a></td>
                            </tr>
                         
                        </table>
                    </td>
<td width="100%" valign="top">
<table width="94%" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td height=2 bgcolor="#889096" colspan="2"></td>
</tr>
<tr style="border-bottom:1px solid #E7E7E7;">
<td width="140" style="font-weight:bold; padding:5px 0; vertical-align:top; color:#000;">{$list[$i][wr_1]} :</td>
<td style="padding:5px 0; vertical-align:top;">{$checkbox}{$list[$i][subject]}</td>
</tr>

<tr style="border-bottom:1px solid #E7E7E7;">
<td style="font-weight:bold; padding:5px 0; vertical-align:top; color:#000;">Qualification :</td>
<td style="padding:5px 0; vertical-align:top;">{$list[$i][wr_2]}</td>
</tr>

<tr style="border-bottom:1px solid #E7E7E7;">
<td style="font-weight:bold; padding:5px 0; vertical-align:top; color:#000;">Education :</td>
<td style="padding:5px 0; vertical-align:top;">{$list[$i][wr_3]}</td>
</tr>

<tr style="border-bottom:1px solid #E7E7E7;">
<td style="font-weight:bold; padding:5px 0; vertical-align:top; color:#000;">Experience :</td> 
<td style="padding:5px 0; vertical-align:top;">{$list[$i][wr_4]}</td>
</tr>
<tr>
<td height="10" ></td>
</tr>
<!-- <tr>
<td>
{$view_href}{$wr_guide}</a>
</td>
</tr> -->
</table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
<!--    <tr>
        <td height="10">&nbsp;</td>
    </tr>
</table>

저폼안에다가도 인풋 히든으로 값들을 넣으면 될거 같은뎀..
폼으로 get값을 전송하려면 
<input type='text' name='aaa' value='a'/>
<input type='text' name='bbb' value='bb'/>

위처럼 보내려는 모든 정보를 form안에 input 으로 넣으세요

<form name="fboardlist" method="post">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="sfl"  value="<?=$sfl?>">
<input type="hidden" name="stx"  value="<?=$stx?>">
<input type="hidden" name="spt"  value="<?=$spt?>">
<input type="hidden" name="page" value="<?=$page?>">
<input type="hidden" name="sw"  value="">

답변을 작성하시기 전에 로그인 해주세요.
전체 18
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT