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년 전 | 476 | ||
| 7929 | 9년 전 | 410 | ||
| 7928 | 9년 전 | 486 | ||
| 7927 | 9년 전 | 390 | ||
| 7926 | 9년 전 | 696 | ||
| 7925 | 9년 전 | 421 | ||
| 7924 | 9년 전 | 403 | ||
| 7923 | 9년 전 | 390 | ||
| 7922 | 9년 전 | 420 | ||
| 7921 | 9년 전 | 435 | ||
| 7920 | 9년 전 | 345 | ||
| 7919 | 9년 전 | 356 | ||
| 7918 | 9년 전 | 510 | ||
| 7917 | 9년 전 | 363 | ||
| 7916 | 9년 전 | 452 | ||
| 7915 | 9년 전 | 467 | ||
| 7914 | 9년 전 | 476 | ||
| 7913 | 9년 전 | 655 | ||
| 7912 | 9년 전 | 489 | ||
| 7911 | 9년 전 | 409 | ||
| 7910 | 9년 전 | 460 | ||
| 7909 | 9년 전 | 574 | ||
| 7908 | 9년 전 | 512 | ||
| 7907 | 9년 전 | 447 | ||
| 7906 | 9년 전 | 468 | ||
| 7905 | 9년 전 | 434 | ||
| 7904 | 9년 전 | 421 | ||
| 7903 | 9년 전 | 434 | ||
| 7902 | 9년 전 | 606 | ||
| 7901 |
|
9년 전 | 772 | |
| 7900 | 9년 전 | 666 | ||
| 7899 | 9년 전 | 450 | ||
| 7898 | 9년 전 | 448 | ||
| 7897 | 9년 전 | 408 | ||
| 7896 | 9년 전 | 423 | ||
| 7895 | 9년 전 | 542 | ||
| 7894 | 9년 전 | 447 | ||
| 7893 | 9년 전 | 425 | ||
| 7892 | 9년 전 | 461 | ||
| 7891 | 9년 전 | 818 | ||
| 7890 | 9년 전 | 1237 | ||
| 7889 | 9년 전 | 772 | ||
| 7888 |
limsy1987
|
9년 전 | 585 | |
| 7887 | 9년 전 | 636 | ||
| 7886 | 9년 전 | 523 | ||
| 7885 | 9년 전 | 494 | ||
| 7884 | 9년 전 | 486 | ||
| 7883 | 9년 전 | 493 | ||
| 7882 | 9년 전 | 550 | ||
| 7881 | 9년 전 | 527 | ||
| 7880 | 9년 전 | 641 | ||
| 7879 | 9년 전 | 531 | ||
| 7878 | 9년 전 | 1302 | ||
| 7877 | 9년 전 | 825 | ||
| 7876 | 9년 전 | 567 | ||
| 7875 | 9년 전 | 640 | ||
| 7874 |
|
9년 전 | 835 | |
| 7873 | 9년 전 | 563 | ||
| 7872 | 9년 전 | 731 | ||
| 7871 | 9년 전 | 546 | ||
| 7870 | 10년 전 | 666 | ||
| 7869 | 10년 전 | 481 | ||
| 7868 | 10년 전 | 522 | ||
| 7867 | 10년 전 | 529 | ||
| 7866 | 10년 전 | 586 | ||
| 7865 | 10년 전 | 530 | ||
| 7864 | 10년 전 | 583 | ||
| 7863 | 10년 전 | 578 | ||
| 7862 | 10년 전 | 546 | ||
| 7861 | 10년 전 | 714 | ||
| 7860 | 10년 전 | 695 | ||
| 7859 | 10년 전 | 465 | ||
| 7858 | 10년 전 | 776 | ||
| 7857 | 10년 전 | 1161 | ||
| 7856 | 10년 전 | 585 | ||
| 7855 | 10년 전 | 824 | ||
| 7854 | 10년 전 | 757 | ||
| 7853 | 10년 전 | 662 | ||
| 7852 | 10년 전 | 583 | ||
| 7851 | 10년 전 | 586 | ||
| 7850 | 10년 전 | 655 | ||
| 7849 | 10년 전 | 425 | ||
| 7848 | 10년 전 | 492 | ||
| 7847 | 10년 전 | 731 | ||
| 7846 | 10년 전 | 516 | ||
| 7845 | 10년 전 | 493 | ||
| 7844 | 10년 전 | 455 | ||
| 7843 | 10년 전 | 492 | ||
| 7842 | 10년 전 | 476 | ||
| 7841 | 10년 전 | 445 | ||
| 7840 | 10년 전 | 463 | ||
| 7839 | 10년 전 | 515 | ||
| 7838 | 10년 전 | 576 | ||
| 7837 | 10년 전 | 404 | ||
| 7836 | 10년 전 | 452 | ||
| 7835 | 10년 전 | 535 | ||
| 7834 |
|
10년 전 | 1232 | |
| 7833 | 10년 전 | 499 | ||
| 7832 | 10년 전 | 475 | ||
| 7831 | 10년 전 | 639 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기