Hi all!
I have a poll on this site As you can see, it is written in ASP, I need to convert it to PHP. Of course, this is new to me and I do not know PHP, so I need to figure this out. I need the poll to also have an administrative feature that allows someone else (who has authority)to enter a new question and choices.
Could someone please point me in the right direction?
Here is a piece of code that I have so far for the administrative piece, if anyone would like to take a glance and see if I am even on the right track.
Any help would be extremely appreciated!!!
Thanks!!!!
<?
usr="root";
$pwd="";
$db="poll";
$host="10.100.2.51";
$cid=mysql_connect($host,$usr,$pwd);
?>
<?
$SQL="SELECT * FROM EVENT_REG WHERE ID='".$id."'" ;
$result = mysql_db_query($db, "$SQL", $cid);
if (!$result) { print("ERROR: " . mysql_error()."\n$SQL\n"
;}
$arrList = mysql_fetch_array($result);
var_dump($arrList);
?>
<?
// connect to database and query
$connection = mysql_connect($host, $usr, $pwd) or die ("Unable to connect!"
;
?>
<HTML>
<HEAD>
<TITLE>Display</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" >
<table width="35%" border="1" cellpadding="3" height="369">
<tr>
<td height="308">
<?
$SQL = " SELECT * FROM Poll ";
$result = my_sql_query ($SQL);
mysql_fetch_array($arrPoll)
?>
<form method="post" action="display.php">
<?
=$arrPoll("Question"
?>
<br>
<br>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_1"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_2"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_3"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_4"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_5"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_6"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_7"
?>
<p>
<input type=submit name=submit value="Vote">
</form>
</td>
</tr>
</table>
<?
if (answer=1) {
$new_value=$arrPoll("Vote_1"
++
if (answer=2) {
$new_value=$arrPoll("Vote_2"
++
if (answer=2) {
$new_value=$arrPoll("Vote_3"
++
if (answer=4) {
$new_value=$arrPoll("Vote_4"
++
if (answer=5) {
$new_value=$arrPoll("Vote_5"
++
if (answer=6) {
$new_value=$arrPoll("Vote_6"
++
if (answer=7) {
$new_value=$arrPoll("Vote_7"
++
}
}
}
}
}
}
}
?>
<?
// close connection
mysql_close($connection);
?>
</body>
</html>
I have a poll on this site As you can see, it is written in ASP, I need to convert it to PHP. Of course, this is new to me and I do not know PHP, so I need to figure this out. I need the poll to also have an administrative feature that allows someone else (who has authority)to enter a new question and choices.
Could someone please point me in the right direction?
Here is a piece of code that I have so far for the administrative piece, if anyone would like to take a glance and see if I am even on the right track.
Any help would be extremely appreciated!!!
Thanks!!!!
<?
usr="root";
$pwd="";
$db="poll";
$host="10.100.2.51";
$cid=mysql_connect($host,$usr,$pwd);
?>
<?
$SQL="SELECT * FROM EVENT_REG WHERE ID='".$id."'" ;
$result = mysql_db_query($db, "$SQL", $cid);
if (!$result) { print("ERROR: " . mysql_error()."\n$SQL\n"
$arrList = mysql_fetch_array($result);
var_dump($arrList);
?>
<?
// connect to database and query
$connection = mysql_connect($host, $usr, $pwd) or die ("Unable to connect!"
?>
<HTML>
<HEAD>
<TITLE>Display</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" >
<table width="35%" border="1" cellpadding="3" height="369">
<tr>
<td height="308">
<?
$SQL = " SELECT * FROM Poll ";
$result = my_sql_query ($SQL);
mysql_fetch_array($arrPoll)
?>
<form method="post" action="display.php">
<?
=$arrPoll("Question"
?>
<br>
<br>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_1"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_2"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_3"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_4"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_5"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_6"
?>
<p>
<input type="radio" name=Answer value=1>
<?
=$arrPoll ("Response_7"
?>
<p>
<input type=submit name=submit value="Vote">
</form>
</td>
</tr>
</table>
<?
if (answer=1) {
$new_value=$arrPoll("Vote_1"
if (answer=2) {
$new_value=$arrPoll("Vote_2"
if (answer=2) {
$new_value=$arrPoll("Vote_3"
if (answer=4) {
$new_value=$arrPoll("Vote_4"
if (answer=5) {
$new_value=$arrPoll("Vote_5"
if (answer=6) {
$new_value=$arrPoll("Vote_6"
if (answer=7) {
$new_value=$arrPoll("Vote_7"
}
}
}
}
}
}
}
?>
<?
// close connection
mysql_close($connection);
?>
</body>
</html>