Solved

Make poll system

Posted on 2013-05-28
4
170 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
Comment Utility
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
Comment Utility
Hi!

Customer want this to be buttons
0
 
LVL 4

Expert Comment

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

Author Closing Comment

by:team2005
Comment Utility
thanks
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

771 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

15 Experts available now in Live!

Get 1:1 Help Now