Nieuw lid |
|
Mmh, straks nog eens verder proberen. Ik kan gerust met iets anders beginnen, want ik doe dit voor mijn plezier, maar ik blijf er toch weer mee klungelen. Te koppig om op te geven voor het werkt . Maar goed, nu is er toch even pauze nodig.
<!--setting the number of options-->
<div id="SettingNumberOfOptions">
<form action="poll.php" method="POST">
<input type="text" value="NumberOfOptions">
<input type="button" value="submit"></form>
</div>
<?php
$NumberOfOptions = $_GET['NumberOfOptions'];
// Check if we have atleast two options
if ($NumberOfOptions <= 1){
echo "Please choose atleast two options.";
}
else {
// Dynamically making variables with $variableA{$variableB} - NOT sure if this actually works!
for($InitValue = 1; $InitValue <= $NumberOfOptions; $InitValue++) {
$option[] = "Optie".$InitValue;
}
//diplay as many input boxes as there were options defined
echo "<div id='ShowOptions'>";
echo "<form action='poll.php' method='get'>";
for($InitValue = 1; $InitValue <= $NumberOfOptions; $InitValue++) {
echo "<input type='text' value='$option[$InitValue]'>";
}
echo "<input type='button' value='submit'>";
echo "</form>";
echo "</div>";
// Defining options and writing them to variables
for($InitValue = 1; $InitValue <= $NumberOfOptions; $InitValue++) {
$option[$InitValue] = $_GET['option'.$InitValue];
}
//diplaying the poll with the defined variables
echo "<div id='ShowPoll'>";
echo "<form 'poll.php' method='get'>";
for($InitValue = 1; $InitValue <= $NumberOfOptions; $InitValue++) {
echo "<input type='radio' value='$option[$InitValue]>";
}
echo "<input type='button' value='submit'>";
echo "</form>";
echo "</div>";
}
?>
<div id="poll">
<input type="radio" value="$option1" />$option1<br>
</div>
<!--setting the number of options--> <div id="SettingNumberOfOptions"> <form action="poll.php" method="POST"> <input type="text" value="NumberOfOptions"> <input type="button" value="submit"></form> </div> <?php $NumberOfOptions = $_GET['NumberOfOptions']; // Check if we have atleast two options if ($NumberOfOptions <= 1){ echo "Please choose atleast two options."; } else { // Dynamically making variables with $variableA{$variableB} - NOT sure if this actually works! for($InitValue = 1; $InitValue <= $NumberOfOptions; $InitValue++) { $option[] = "Optie".$InitValue; } //diplay as many input boxes as there were options defined echo "<div id='ShowOptions'>"; echo "<form action='poll.php' method='get'>"; for($InitValue = 1; $InitValue <= $NumberOfOptions; $InitValue++) { echo "<input type='text' value='$option[$InitValue]'>"; } echo "<input type='button' value='submit'>"; // Defining options and writing them to variables for($InitValue = 1; $InitValue <= $NumberOfOptions; $InitValue++) { $option[$InitValue] = $_GET['option'.$InitValue]; } //diplaying the poll with the defined variables echo "<div id='ShowPoll'>"; echo "<form 'poll.php' method='get'>"; for($InitValue = 1; $InitValue <= $NumberOfOptions; $InitValue++) { echo "<input type='radio' value='$option[$InitValue]>"; } echo "<input type='button' value='submit'>"; } ?> <div id="poll"> <input type="radio" value="$option1" />$option1<br> </div>
|