설문조사용


<--survey.sql-->

 

create table eventuser(
no int unsigned NOT NULL auto_increment primary key,
name varchar(20),
S1 varchar(6),
) ENGINE=MyISAM CHARSET=euckr;


<--dbconn.inc.php-->

<?
$host_name='localhost';
$db_id='root';
$db_name='test';
$db_pass='1234';
$connect = mysql_connect($host_name,$db_id,$db_pass) or die(mysql_error('접속이 안되네요'));
mysql_select_db($db_name,$connect) or die(mysql_error());
mysql_query("set names euckr",$connect);
?>


<--insert.php-->

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />
<HTML>
<head>
  <TITLE> New Document </TITLE>
 </HEAD>

<form method="post" name="theForm" action="save.php">
이름 : <input type="text" name="name"><br><br>
1. 다음중에서 하나를 고르시오<br>
<input type="radio" name="S1" value="1"> (1)맞다
<input type="radio" name="S1" value="2"> (2)아니다
<input type="radio" name="S1" value="3"> (3)모른다
<input type="radio" name="S1" value="4"> (4)답변불응
<Br><Br>
<Input type="submit" value="저장">
</form>

 <BODY>
 
 </BODY>
</HTML>


<--save.php-->

 

<?
include "dbconn.inc.php";

$name  = $_POST['name'];
$S1 = $_POST['S1'];

echo iconv("etf-8","euc-kr",$_POST['name']);
echo iconv("etf-8","euc-kr",$_POST['S1']);

mysql_query("INSERT IGNORE INTO eventuser (name, S1) values('". $name ."', '". $S1 ."')");
?>

<Script Type='Text/Javascript' Language='Javascript'>
<!--

alert("저장 되었습니다.");
  document.location = "print.php";

//-->
</Script>


<--print.php-->

 

<?

include "dbconn.inc.php";

$sql = "select * from eventuser";
$result = mysql_query($sql, $connect);

$fields = mysql_num_fields($result);
echo "<table border=1>
 <tr>
  <td align='center'>순번</td>
  <td align='center'>이름</td>
  <td align='center'>1번</td>
 </tr>";
 while($row = mysql_fetch_row($result)){
echo"<tr>";
for($i=0; $i<=$fields; $i++){
 echo"<td align='center'>".$row[$i]."</td>";
}
echo "</tr>";
};
echo "</table>";
?>


 

'TECHNOLOGY > PHP' 카테고리의 다른 글

[PHP] Server Ping Auto Test (15초마다)  (1) 2012.06.19


<script language='javascript'>

window.setTimeout('window.location.reload()',15000);

</script>

 

<font size=5; color=red>GOGO</font>

<font size=5; color=blue> Server Ping Test</font>
<br>


<?php
$now=date("Y-m-d-H:i:s");
$host=array(
        '192.168.0.101' => 'Main DB',
        '192.168.0.102' => 'IMAGE',
        '192.168.0.103' => 'Homepage',
 );

foreach($host as $ip => $hostname) {

$output = shell_exec("ping -c2 -w2 $ip");
if(strpos($output, '0 received')){
  echo "$ip ping <font size=5; color=red>Failed</font> - $hostname <br />";
}else{
  echo "$ip ping <font size=5>Succeeded</font> - $hostname <br />";
 }
}

echo("<br><font size=3> Update time : $now </font> <br />");
?>

'TECHNOLOGY > PHP' 카테고리의 다른 글

[PHP] 설문조사 (MySQL & PHP) - MyISAM [한글지원: euc-kr]  (0) 2012.07.18

+ Recent posts