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(){
      //
 


      }
</script>

<?
  mysql_close($connect);
?>
-----------------------------------------------------------
디비를 읽어와서 뿌리는데 회원명을 클릭시에 input에 자료를 넣고 싶읍니다.
소스나 링크 도움 부탁드립니다.
|

댓글 2개

순수하게 자바스크립트로 하실꺼라면
<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>

이렇게 하시면 됩니다
대단히 감사합니다.
이 방법이 외에 다른 방법이 잇다면 알려주시면 감사하겟읍니다.
sql 로 해결 할수 잇으면 좋겟는데요..
이번에 홈페이지 한번 만들어 보면서 배울려고요..
<?=$row[mb_name]?>','<?=$row[mb_nick]?>','<?=$row[mb_homepage]?>','<?=$row[mb_hp]?>')> <-- $가 빠졋내요..
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
13년 전 조회 701
13년 전 조회 1,484
13년 전 조회 1,009
13년 전 조회 4,062
13년 전 조회 2,057
13년 전 조회 884
13년 전 조회 704
13년 전 조회 1,279
13년 전 조회 905
13년 전 조회 1,037
13년 전 조회 2,131
13년 전 조회 781
13년 전 조회 2,836
13년 전 조회 2,828
13년 전 조회 1,095
13년 전 조회 793
13년 전 조회 2,335
13년 전 조회 911
13년 전 조회 1,168
13년 전 조회 698
13년 전 조회 1,822
13년 전 조회 1,117
13년 전 조회 1,171
13년 전 조회 1,519
13년 전 조회 617
13년 전 조회 3,685
13년 전 조회 928
13년 전 조회 1,808
13년 전 조회 1,305
13년 전 조회 681
13년 전 조회 4,662
13년 전 조회 536
13년 전 조회 2,651
13년 전 조회 1,002
13년 전 조회 670
13년 전 조회 1,039
13년 전 조회 7,804
13년 전 조회 985
13년 전 조회 2,074
13년 전 조회 1,518
13년 전 조회 1,051
13년 전 조회 4,112
13년 전 조회 718
13년 전 조회 1,201
13년 전 조회 835
13년 전 조회 887
13년 전 조회 1,571
13년 전 조회 2,370
13년 전 조회 907
13년 전 조회 1,025
13년 전 조회 969
13년 전 조회 1,335
13년 전 조회 581
13년 전 조회 1,047
13년 전 조회 551
13년 전 조회 966
13년 전 조회 720
13년 전 조회 1,157
13년 전 조회 1,582
13년 전 조회 1,237
13년 전 조회 9,420
13년 전 조회 1,791
13년 전 조회 3,370
13년 전 조회 492
13년 전 조회 1,475
13년 전 조회 725
13년 전 조회 572
13년 전 조회 566
13년 전 조회 4,330
13년 전 조회 1,528
13년 전 조회 2,012
13년 전 조회 697
13년 전 조회 1,058
13년 전 조회 1,577
13년 전 조회 575
13년 전 조회 1,631
13년 전 조회 1,351
13년 전 조회 3,039
13년 전 조회 1,035
13년 전 조회 2,282
13년 전 조회 1,158
13년 전 조회 1,084
13년 전 조회 1,163
13년 전 조회 1,608
14년 전 조회 1,190
14년 전 조회 564
14년 전 조회 826
14년 전 조회 987
14년 전 조회 656
14년 전 조회 7,389
14년 전 조회 6,413
14년 전 조회 639
14년 전 조회 802
14년 전 조회 1,016
14년 전 조회 627
14년 전 조회 716
14년 전 조회 1,029
14년 전 조회 1,003
14년 전 조회 2,308
14년 전 조회 639
🐛 버그신고