Solved

Make poll system

Posted on 2013-05-28
4
172 Views
Last Modified: 2013-06-05
Hi!

Have this included picture.

Have 2 questions and 1 Open question.

System must call a new webpage (php)
depending of what button is pressed.

How is the best way to make this system ?
Call the same php file using parameter transfer ?

Or is the best way to have multipel pages ?

Include my php file for the picture included.

<?php // RAY_EE_login.php
require_once('RAY_EE_config.php');
?>
<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8" />
<title>Test system</title>

</head>

<body>
<link rel="stylesheet" href="default.css">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<table summary="Services, or Links box template" class="servicesT" cellspacing="1">
<tr><td colspan="2" class="servHd">Mine kontroller</td></tr>
<tr>
	<td class="servBodL" width="92%">Vernerunde #1</td>
	<td class="servBodL" width="8%"><input type="submit" id="GULKN" name="B1" value=">"></td>
</tr>
<tr>
	<td class="servBodL" width="92%">Årskontroll #2</td>
	<td class="servBodL" width="8%"><input type="submit" id="GULKN" name="B2" value=">"></td>
</tr>
</table>
<br>
<table summary="Services, or Links box template" class="servicesT" cellspacing="0">
<tr><td colspan="2" class="servHd">Mine Åpne kontroller</td></tr>
<tr>
	<td class="TESTE" width="92%">Vernerunde 020513</td>
	<td class="servBodL" width="8%"><input type="submit" id="GULKN" name="B3" value=">"></td>
</tr>
</table>
<br><br>
<table summary="Services, or Links box template" class="servicesT" cellspacing="0">
<tr>
	<td width="100%"><input type="submit" id="LOGGUT" value="Logg ut"></td>
</tr>

</table>


</body>
</html>

Open in new window


The questions is stored in my mysql database, and it can be more then 2 questions..
Using for loop here ?
Maby store the questions in a array ?
spr1.png
0
Comment
Question by:team2005
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
Ahmed Hussein earned 500 total points
ID: 39201348
You can basicly change the submit buttons to Radio buttons with different values for each answer, and you can make simple javascript code that triggers when you click on one of the radio buttons like that:

<script type="text/javascript">
function submitForm(){
    document.getElementById("form_id").submit();
}
</script>
<form id="form_id" method="post" action="url to your php page">
     <input type="radio" name="answer" value="answer number 1" onclick="submitForm();"/>
</form>

Open in new window


and inside your php code you can basically get the value of the posted radio that way

<?php
  echo $_POST["answer"];
?>

Open in new window

0
 
LVL 2

Author Comment

by:team2005
ID: 39201499
Hi!

Customer want this to be buttons
0
 
LVL 4

Expert Comment

by:Ahmed Hussein
ID: 39201514
Make it radio and style it as a button.
0
 
LVL 2

Author Closing Comment

by:team2005
ID: 39221448
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now