묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
<!-- poll.html -->
<html>
<head>
<title> php예제 </title>
<script>
function checknsubmit(){
var data = document.mainform;
if(!data.ans.value){
alert('하나를 선택해 주십시오.');
return;
}
data.submit();
}
</script>
</head>
<body bgcolor=white>
<center>
<form method=post action=poll_post.php name=mainform>
<input type=hidden name=number value='<?echo $number;?>'>
<table border=1 cellspacing=0 cellpadding=5 bordercolor=#ffccff>
<tr>
<td>
<table border=0 cellspacing=2 cellpadding=0>
<?
$conn = mysql_connect('localhost','root','apmsetup');
mysql_select_db('sadm'+ '+ ', $conn);
$query = "select issue,ans1,ans2,ans3,ans4,ans5,ans6,ans7,ans8,edate from poll";
$query.= " where number = $number";
$result = mysql_query($query , $conn);
$data = mysql_fetch_array($result); <!--33번 에러 자리-->
if(!$data[edate]){
echo("
<tr>
<td colspan=2 align=center bgcolor=#dddddd>
<b> $data[issue] </b>
</td>
</tr>
");
if($data[ans0]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans0] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=0></td>
</tr>
");
}
if($data[ans1]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans1] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=1></td>
</tr>
");
}
if($data[ans2]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans2] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=2></td>
</tr>
");
}
if($data[ans3]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans3] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=3></td>
</tr>
");
}
if($data[ans4]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans4] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=4></td>
</tr>
");
}
if($data[ans5]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans5] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=5></td>
</tr>
");
}
if($data[ans6]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans6] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=6></td>
</tr>
");
}
if($data[ans7]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans7] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=7></td>
</tr>
");
}
}
else{
echo("
<tr>
<td colspan=2 align=center>
<b> $data[issue] </b>
<br>
이 설문은 $data[edate] 에 종료하였습니다 <br>
</td>
</tr>
");
}
?>
<tr>
<td colspan=2 align=center>
<input type=button value='확인' onclick=.javascriptchecknsubmit{}>
[<a href=poll_view.html?number=<?echo $number;?>> 결과보기 </a>]
</td>
</table>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
----------------------------
라디오 네임이 같아서 그런가요?
하나만 선택하면 넘어가야 하는데 그렇게 안돼네요 ?
스크립트 오류가 자꾸 생기내요 라디오 체크하고 해도 체크하라고..
2004.08.01 20:30
<!-- poll.html -->
<html>
<head>
<title> php예제 </title>
<script>
function checknsubmit(){
var data = document.mainform;
if(!data.ans.value){
alert('하나를 선택해 주십시오.');
return;
}
data.submit();
}
</script>
</head>
<body bgcolor=white>
<center>
<form method=post action=poll_post.php name=mainform>
<input type=hidden name=number value='<?echo $number;?>'>
<table border=1 cellspacing=0 cellpadding=5 bordercolor=#ffccff>
<tr>
<td>
<table border=0 cellspacing=2 cellpadding=0>
<?
$conn = mysql_connect('localhost','root','apmsetup');
mysql_select_db('sadm'+ '+ ', $conn);
$query = "select issue,ans1,ans2,ans3,ans4,ans5,ans6,ans7,ans8,edate from poll";
$query.= " where number = $number";
$result = mysql_query($query , $conn);
$data = mysql_fetch_array($result); <!--33번 에러 자리-->
if(!$data[edate]){
echo("
<tr>
<td colspan=2 align=center bgcolor=#dddddd>
<b> $data[issue] </b>
</td>
</tr>
");
if($data[ans0]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans0] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=0></td>
</tr>
");
}
if($data[ans1]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans1] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=1></td>
</tr>
");
}
if($data[ans2]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans2] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=2></td>
</tr>
");
}
if($data[ans3]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans3] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=3></td>
</tr>
");
}
if($data[ans4]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans4] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=4></td>
</tr>
");
}
if($data[ans5]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans5] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=5></td>
</tr>
");
}
if($data[ans6]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans6] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=6></td>
</tr>
");
}
if($data[ans7]){
echo("
<br>
<td align=center bgcolor=#dddddd> $data[ans7] </td>
<td bgcolor=#eeeeee><input type=radio name=ans value=7></td>
</tr>
");
}
}
else{
echo("
<tr>
<td colspan=2 align=center>
<b> $data[issue] </b>
<br>
이 설문은 $data[edate] 에 종료하였습니다 <br>
</td>
</tr>
");
}
?>
<tr>
<td colspan=2 align=center>
<input type=button value='확인' onclick=.javascriptchecknsubmit{}>
[<a href=poll_view.html?number=<?echo $number;?>> 결과보기 </a>]
</td>
</table>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
----------------------------
라디오 네임이 같아서 그런가요?
하나만 선택하면 넘어가야 하는데 그렇게 안돼네요 ?