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]?>')> <-- $가 빠졋내요..
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8030 | 9년 전 | 414 | ||
| 8029 | 9년 전 | 336 | ||
| 8028 | 9년 전 | 295 | ||
| 8027 | 9년 전 | 308 | ||
| 8026 | 9년 전 | 379 | ||
| 8025 | 9년 전 | 410 | ||
| 8024 | 9년 전 | 397 | ||
| 8023 | 9년 전 | 424 | ||
| 8022 | 9년 전 | 339 | ||
| 8021 | 9년 전 | 362 | ||
| 8020 | 9년 전 | 361 | ||
| 8019 | 9년 전 | 376 | ||
| 8018 | 9년 전 | 478 | ||
| 8017 | 9년 전 | 559 | ||
| 8016 | 9년 전 | 382 | ||
| 8015 | 9년 전 | 417 | ||
| 8014 | 9년 전 | 347 | ||
| 8013 | 9년 전 | 269 | ||
| 8012 | 9년 전 | 270 | ||
| 8011 | 9년 전 | 478 | ||
| 8010 | 9년 전 | 333 | ||
| 8009 | 9년 전 | 349 | ||
| 8008 | 9년 전 | 317 | ||
| 8007 | 9년 전 | 465 | ||
| 8006 | 9년 전 | 502 | ||
| 8005 |
|
9년 전 | 995 | |
| 8004 | 9년 전 | 385 | ||
| 8003 | 9년 전 | 454 | ||
| 8002 | 9년 전 | 348 | ||
| 8001 |
|
9년 전 | 692 | |
| 8000 | 9년 전 | 457 | ||
| 7999 | 9년 전 | 408 | ||
| 7998 | 9년 전 | 466 | ||
| 7997 | 9년 전 | 336 | ||
| 7996 | 9년 전 | 565 | ||
| 7995 | 9년 전 | 512 | ||
| 7994 | 9년 전 | 401 | ||
| 7993 | 9년 전 | 470 | ||
| 7992 | 9년 전 | 542 | ||
| 7991 | 9년 전 | 289 | ||
| 7990 | 9년 전 | 325 | ||
| 7989 | 9년 전 | 329 | ||
| 7988 | 9년 전 | 758 | ||
| 7987 | 9년 전 | 461 | ||
| 7986 | 9년 전 | 463 | ||
| 7985 | 9년 전 | 542 | ||
| 7984 | 9년 전 | 461 | ||
| 7983 | 9년 전 | 697 | ||
| 7982 | 9년 전 | 558 | ||
| 7981 | 9년 전 | 516 | ||
| 7980 | 9년 전 | 537 | ||
| 7979 | 9년 전 | 528 | ||
| 7978 | 9년 전 | 491 | ||
| 7977 | 9년 전 | 432 | ||
| 7976 | 9년 전 | 891 | ||
| 7975 | 9년 전 | 405 | ||
| 7974 | 9년 전 | 449 | ||
| 7973 | 9년 전 | 631 | ||
| 7972 | 9년 전 | 423 | ||
| 7971 | 9년 전 | 498 | ||
| 7970 | 9년 전 | 341 | ||
| 7969 | 9년 전 | 579 | ||
| 7968 | 9년 전 | 427 | ||
| 7967 | 9년 전 | 411 | ||
| 7966 | 9년 전 | 416 | ||
| 7965 |
|
9년 전 | 1045 | |
| 7964 | 9년 전 | 434 | ||
| 7963 | 9년 전 | 443 | ||
| 7962 | 9년 전 | 443 | ||
| 7961 |
전갈자리남자
|
9년 전 | 535 | |
| 7960 | 9년 전 | 1002 | ||
| 7959 | 9년 전 | 585 | ||
| 7958 | 9년 전 | 436 | ||
| 7957 | 9년 전 | 393 | ||
| 7956 | 9년 전 | 390 | ||
| 7955 | 9년 전 | 493 | ||
| 7954 | 9년 전 | 429 | ||
| 7953 | 9년 전 | 476 | ||
| 7952 | 9년 전 | 398 | ||
| 7951 | 9년 전 | 529 | ||
| 7950 | 9년 전 | 426 | ||
| 7949 | 9년 전 | 418 | ||
| 7948 | 9년 전 | 355 | ||
| 7947 | 9년 전 | 973 | ||
| 7946 | 9년 전 | 488 | ||
| 7945 | 9년 전 | 433 | ||
| 7944 | 9년 전 | 491 | ||
| 7943 | 9년 전 | 423 | ||
| 7942 | 9년 전 | 437 | ||
| 7941 | 9년 전 | 428 | ||
| 7940 | 9년 전 | 928 | ||
| 7939 | 9년 전 | 419 | ||
| 7938 | 9년 전 | 436 | ||
| 7937 | 9년 전 | 325 | ||
| 7936 | 9년 전 | 908 | ||
| 7935 | 9년 전 | 509 | ||
| 7934 | 9년 전 | 488 | ||
| 7933 | 9년 전 | 615 | ||
| 7932 | 9년 전 | 553 | ||
| 7931 | 9년 전 | 614 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기