onclick시에 디비 읽어 와서 inputdp넣기

클릭시에 디비를 회원프로필에 뿌려주는 기능입니다.
자바스크립트 부분에서 막힌것 같읍니다.
소스는 ....
<div style="margin-top:20px;margin-left:30px;padding:10px;border:1px dotted #445566;float:left;width:180px">
<?
$connect = mysql_connect("localhost","xxxxx","1234") or die("접속불가");
mysql_select_db("xxxx");
$sql = " select * from g4_member where mb_level = 4 and mb_jiwon_level >= 2 ";
$result = mysql_query($sql , $connect);
while($row=mysql_fetch_array($result)) { ?>
<p onclick=getdata_1()> <?=$row[mb_nick]?> </p>
<? }?>
</div>
<div style="margin-top:20px;margin-left:20px;padding:10px;border:1px dotted #445566;float:left;width:500px">
<form>
<fieldset>
<legend> 프로필</legend>
<li>별명 : <input type=text name='mb_nick' value=<?=$row[mb_nick]?> >
<li>홈피 : <input type=text name='mb_homepage' value=<?=$row[mb_homepage]?> >
<li>핸펀 : <input type=text name='mb_hp' value=<?=$row[mb_hp]?> >
</fieldset>
</form>
</div>
<script >
function getdata_1(){
//
자바스크립트 부분에서 막힌것 같읍니다.
소스는 ....
<div style="margin-top:20px;margin-left:30px;padding:10px;border:1px dotted #445566;float:left;width:180px">
<?
$connect = mysql_connect("localhost","xxxxx","1234") or die("접속불가");
mysql_select_db("xxxx");
$sql = " select * from g4_member where mb_level = 4 and mb_jiwon_level >= 2 ";
$result = mysql_query($sql , $connect);
while($row=mysql_fetch_array($result)) { ?>
<p onclick=getdata_1()> <?=$row[mb_nick]?> </p>
<? }?>
</div>
<div style="margin-top:20px;margin-left:20px;padding:10px;border:1px dotted #445566;float:left;width:500px">
<form>
<fieldset>
<legend> 프로필</legend>
<li>별명 : <input type=text name='mb_nick' value=<?=$row[mb_nick]?> >
<li>홈피 : <input type=text name='mb_homepage' value=<?=$row[mb_homepage]?> >
<li>핸펀 : <input type=text name='mb_hp' value=<?=$row[mb_hp]?> >
</fieldset>
</form>
</div>
<script >
function getdata_1(){
//
}
</script>
<?
mysql_close($connect);
?>
-----------------------------------------------------------
디비를 읽어와서 뿌리는데 회원명을 클릭시에 input에 자료를 넣고 싶읍니다.
소스나 링크 도움 부탁드립니다.
댓글 2개
넓은마인드
13년 전
순수하게 자바스크립트로 하실꺼라면
<p onclick=getdata_1()> <?=$row[mb_nick]?> </p>
에서 getdata_1 호출하실때 관련내용 몽땅 넘겨주시면 됩니다..
ex.)<p onclick=getdata_1('<?=row[mb_name]?>','<?=row[mb_nick]?>','<?=row[mb_homepage]?>','<?=row[mb_hp]?>')> <?=$row[mb_nick]?> </p>
요렇게 넘기시고
<script >
function getdata_1(name,nick,homepage,hp){
//
document.all.mb_name.value = name;
document.all.mb_nick.value = nick;
document.all.mb_homepage.value = homepage;
document.all.mb_hp.value = hp;
}
</script>
이렇게 하시면 됩니다
<p onclick=getdata_1()> <?=$row[mb_nick]?> </p>
에서 getdata_1 호출하실때 관련내용 몽땅 넘겨주시면 됩니다..
ex.)<p onclick=getdata_1('<?=row[mb_name]?>','<?=row[mb_nick]?>','<?=row[mb_homepage]?>','<?=row[mb_hp]?>')> <?=$row[mb_nick]?> </p>
요렇게 넘기시고
<script >
function getdata_1(name,nick,homepage,hp){
//
document.all.mb_name.value = name;
document.all.mb_nick.value = nick;
document.all.mb_homepage.value = homepage;
document.all.mb_hp.value = hp;
}
</script>
이렇게 하시면 됩니다
13년 전
대단히 감사합니다.
이 방법이 외에 다른 방법이 잇다면 알려주시면 감사하겟읍니다.
sql 로 해결 할수 잇으면 좋겟는데요..
이번에 홈페이지 한번 만들어 보면서 배울려고요..
<?=$row[mb_name]?>','<?=$row[mb_nick]?>','<?=$row[mb_homepage]?>','<?=$row[mb_hp]?>')> <-- $가 빠졋내요..
이 방법이 외에 다른 방법이 잇다면 알려주시면 감사하겟읍니다.
sql 로 해결 할수 잇으면 좋겟는데요..
이번에 홈페이지 한번 만들어 보면서 배울려고요..
<?=$row[mb_name]?>','<?=$row[mb_nick]?>','<?=$row[mb_homepage]?>','<?=$row[mb_hp]?>')> <-- $가 빠졋내요..
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 173 | ||
| 8229 | 9년 전 | 154 | ||
| 8228 |
커네드커네드
|
9년 전 | 197 | |
| 8227 | 9년 전 | 237 | ||
| 8226 | 9년 전 | 254 | ||
| 8225 | 9년 전 | 233 | ||
| 8224 | 9년 전 | 245 | ||
| 8223 | 9년 전 | 219 | ||
| 8222 |
|
9년 전 | 283 | |
| 8221 | 9년 전 | 181 | ||
| 8220 | 9년 전 | 219 | ||
| 8219 | 9년 전 | 196 | ||
| 8218 | 9년 전 | 238 | ||
| 8217 |
star3840
|
9년 전 | 206 | |
| 8216 | 9년 전 | 270 | ||
| 8215 | 9년 전 | 216 | ||
| 8214 | 9년 전 | 328 | ||
| 8213 | 9년 전 | 284 | ||
| 8212 | 9년 전 | 197 | ||
| 8211 | 9년 전 | 365 | ||
| 8210 | 9년 전 | 366 | ||
| 8209 | 9년 전 | 440 | ||
| 8208 | 9년 전 | 331 | ||
| 8207 | 9년 전 | 341 | ||
| 8206 |
|
9년 전 | 284 | |
| 8205 | 9년 전 | 260 | ||
| 8204 | 9년 전 | 248 | ||
| 8203 | 9년 전 | 326 | ||
| 8202 | 9년 전 | 242 | ||
| 8201 | 9년 전 | 272 | ||
| 8200 | 9년 전 | 284 | ||
| 8199 | 9년 전 | 308 | ||
| 8198 | 9년 전 | 272 | ||
| 8197 | 9년 전 | 254 | ||
| 8196 | 9년 전 | 679 | ||
| 8195 | 9년 전 | 266 | ||
| 8194 | 9년 전 | 375 | ||
| 8193 | 9년 전 | 287 | ||
| 8192 | 9년 전 | 299 | ||
| 8191 | 9년 전 | 255 | ||
| 8190 | 9년 전 | 237 | ||
| 8189 | 9년 전 | 297 | ||
| 8188 | 9년 전 | 234 | ||
| 8187 | 9년 전 | 243 | ||
| 8186 | 9년 전 | 241 | ||
| 8185 | 9년 전 | 415 | ||
| 8184 | 9년 전 | 199 | ||
| 8183 | 9년 전 | 409 | ||
| 8182 | 9년 전 | 279 | ||
| 8181 | 9년 전 | 233 | ||
| 8180 | 9년 전 | 802 | ||
| 8179 | 9년 전 | 580 | ||
| 8178 | 9년 전 | 442 | ||
| 8177 |
kiplayer
|
9년 전 | 436 | |
| 8176 | 9년 전 | 469 | ||
| 8175 | 9년 전 | 356 | ||
| 8174 | 9년 전 | 349 | ||
| 8173 | 9년 전 | 436 | ||
| 8172 | 9년 전 | 316 | ||
| 8171 | 9년 전 | 276 | ||
| 8170 | 9년 전 | 400 | ||
| 8169 |
커네드커네드
|
9년 전 | 354 | |
| 8168 | 9년 전 | 435 | ||
| 8167 | 9년 전 | 426 | ||
| 8166 | 9년 전 | 320 | ||
| 8165 | 9년 전 | 265 | ||
| 8164 | 9년 전 | 400 | ||
| 8163 | 9년 전 | 406 | ||
| 8162 | 9년 전 | 390 | ||
| 8161 | 9년 전 | 406 | ||
| 8160 |
|
9년 전 | 624 | |
| 8159 | 9년 전 | 569 | ||
| 8158 | 9년 전 | 362 | ||
| 8157 | 9년 전 | 476 | ||
| 8156 | 9년 전 | 355 | ||
| 8155 | 9년 전 | 361 | ||
| 8154 |
00년생용띠
|
9년 전 | 695 | |
| 8153 | 9년 전 | 327 | ||
| 8152 |
|
9년 전 | 508 | |
| 8151 | 9년 전 | 505 | ||
| 8150 | 9년 전 | 619 | ||
| 8149 |
Jangfolk
|
9년 전 | 479 | |
| 8148 | 9년 전 | 290 | ||
| 8147 | 9년 전 | 475 | ||
| 8146 | 9년 전 | 556 | ||
| 8145 | 9년 전 | 514 | ||
| 8144 | 9년 전 | 483 | ||
| 8143 | 9년 전 | 312 | ||
| 8142 | 9년 전 | 522 | ||
| 8141 | 9년 전 | 467 | ||
| 8140 | 9년 전 | 1031 | ||
| 8139 | 9년 전 | 381 | ||
| 8138 |
전갈자리남자
|
9년 전 | 486 | |
| 8137 | 9년 전 | 521 | ||
| 8136 | 9년 전 | 849 | ||
| 8135 |
|
9년 전 | 895 | |
| 8134 |
PlayPixel
|
9년 전 | 632 | |
| 8133 |
|
9년 전 | 538 | |
| 8132 | 9년 전 | 579 | ||
| 8131 | 9년 전 | 935 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기