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]?>')> <-- $가 빠졋내요..
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 460 | ||
| 7929 | 9년 전 | 395 | ||
| 7928 | 9년 전 | 472 | ||
| 7927 | 9년 전 | 379 | ||
| 7926 | 9년 전 | 689 | ||
| 7925 | 9년 전 | 407 | ||
| 7924 | 9년 전 | 390 | ||
| 7923 | 9년 전 | 380 | ||
| 7922 | 9년 전 | 414 | ||
| 7921 | 9년 전 | 433 | ||
| 7920 | 9년 전 | 343 | ||
| 7919 | 9년 전 | 352 | ||
| 7918 | 9년 전 | 507 | ||
| 7917 | 9년 전 | 359 | ||
| 7916 | 9년 전 | 446 | ||
| 7915 | 9년 전 | 454 | ||
| 7914 | 9년 전 | 468 | ||
| 7913 | 9년 전 | 639 | ||
| 7912 | 9년 전 | 468 | ||
| 7911 | 9년 전 | 398 | ||
| 7910 | 9년 전 | 447 | ||
| 7909 | 9년 전 | 555 | ||
| 7908 | 9년 전 | 494 | ||
| 7907 | 9년 전 | 429 | ||
| 7906 | 9년 전 | 449 | ||
| 7905 | 9년 전 | 420 | ||
| 7904 | 9년 전 | 406 | ||
| 7903 | 9년 전 | 405 | ||
| 7902 | 9년 전 | 593 | ||
| 7901 |
|
9년 전 | 767 | |
| 7900 | 9년 전 | 650 | ||
| 7899 | 9년 전 | 432 | ||
| 7898 | 9년 전 | 430 | ||
| 7897 | 9년 전 | 390 | ||
| 7896 | 9년 전 | 407 | ||
| 7895 | 9년 전 | 523 | ||
| 7894 | 9년 전 | 435 | ||
| 7893 | 9년 전 | 409 | ||
| 7892 | 9년 전 | 448 | ||
| 7891 | 9년 전 | 808 | ||
| 7890 | 9년 전 | 1231 | ||
| 7889 | 9년 전 | 766 | ||
| 7888 |
limsy1987
|
9년 전 | 578 | |
| 7887 | 9년 전 | 615 | ||
| 7886 | 9년 전 | 503 | ||
| 7885 | 9년 전 | 473 | ||
| 7884 | 9년 전 | 464 | ||
| 7883 | 9년 전 | 473 | ||
| 7882 | 9년 전 | 527 | ||
| 7881 | 9년 전 | 502 | ||
| 7880 | 9년 전 | 623 | ||
| 7879 | 9년 전 | 511 | ||
| 7878 | 9년 전 | 1279 | ||
| 7877 | 9년 전 | 810 | ||
| 7876 | 9년 전 | 551 | ||
| 7875 | 9년 전 | 617 | ||
| 7874 |
|
9년 전 | 830 | |
| 7873 | 9년 전 | 552 | ||
| 7872 | 9년 전 | 718 | ||
| 7871 | 9년 전 | 531 | ||
| 7870 | 9년 전 | 649 | ||
| 7869 | 9년 전 | 470 | ||
| 7868 | 9년 전 | 505 | ||
| 7867 | 9년 전 | 505 | ||
| 7866 | 9년 전 | 567 | ||
| 7865 | 9년 전 | 508 | ||
| 7864 | 9년 전 | 570 | ||
| 7863 | 9년 전 | 561 | ||
| 7862 | 9년 전 | 523 | ||
| 7861 | 9년 전 | 694 | ||
| 7860 | 9년 전 | 670 | ||
| 7859 | 9년 전 | 445 | ||
| 7858 | 9년 전 | 753 | ||
| 7857 | 9년 전 | 1140 | ||
| 7856 | 9년 전 | 571 | ||
| 7855 | 9년 전 | 805 | ||
| 7854 | 9년 전 | 754 | ||
| 7853 | 9년 전 | 650 | ||
| 7852 | 9년 전 | 567 | ||
| 7851 | 9년 전 | 563 | ||
| 7850 | 9년 전 | 637 | ||
| 7849 | 9년 전 | 406 | ||
| 7848 | 9년 전 | 470 | ||
| 7847 | 9년 전 | 717 | ||
| 7846 | 9년 전 | 501 | ||
| 7845 | 9년 전 | 470 | ||
| 7844 | 9년 전 | 439 | ||
| 7843 | 9년 전 | 480 | ||
| 7842 | 9년 전 | 463 | ||
| 7841 | 10년 전 | 430 | ||
| 7840 | 10년 전 | 447 | ||
| 7839 | 10년 전 | 493 | ||
| 7838 | 10년 전 | 555 | ||
| 7837 | 10년 전 | 385 | ||
| 7836 | 10년 전 | 444 | ||
| 7835 | 10년 전 | 522 | ||
| 7834 |
|
10년 전 | 1228 | |
| 7833 | 10년 전 | 489 | ||
| 7832 | 10년 전 | 463 | ||
| 7831 | 10년 전 | 624 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기