FromHollandWithLove
Junior Member
Hi. I've been working for hours on this script and it's really starting to get on my nerves now.
First i'll show you what i am talking about: > www.odessa.nl/enquete/hoeveel.html is a wizard that generates a quastionaire. On the second page 'make_page.php' the user can fill out questions and select a response type for each question.
I want a different form to be loaded when each of the response type radio buttons is clicked, buy HOW???
I have seen a lot of examples on the internet using div, innerhtml and other Javscript functions, but i didn't get it to work. 🙁
A problem is that make_page.php is dynamically created by PHP, so any 'id' will have to be based on the variable $i from the for loop. Could someone help me out, or even code something for me? I know this isn't too hard, but i can't seem to figure out the right way to do it.
Thanks very much in advance!
<html>
<head>
<title>Questions</title>
<script language="Javascript">
function cell_create(row, r_type)
{
/* This function should decide what form to load in cell$i */
}
</script>
</head>
<body>
<?php
echo "<table bgcolor='#000000' cellpadding='4' cellspacing='1'><tr><td colspan='4' bgcolor='#f5f5f5'>Your questionaire will contain <b>$aantal</b> questions. Fill out the questions below and select a response type for every question </td></tr>";
echo "<tr bgcolor='#f5f5f5'><td><b>nr</b></td><td><b>question/statement</b></td><td><b>response type</b></td><td width=150><b>specify</b></td></tr>";
for($i=1; $i <=$aantal; $i++)
{
echo "<tr valign=\"top\" bgcolor='#f5f5f5'><td><b>$i</b></td>";
echo "<td><textarea name='vraag$i' rows='4' cols='32'>Fill out question</textarea></td>";
echo "<td>
<input type='radio' name='type_vraag$i' value='type_open' onClick=\"cell_create($i, 1)\">open
<input type='radio' name='type_vraag$i' value='type_number' onClick=\"cell_create($i, 2)\">list of numbers
<input type='radio' name='type_vraag$i' value='type_word' onClick=\"cell_create($i, 3)\">list of words
</td>
<td nowrap id=cell$i>
/* This is where the form should be loaded, depending on what radio box was selected */
</form>
</td></tr>";
}
echo "</table>";
?>
</body>
</html>
First i'll show you what i am talking about: > www.odessa.nl/enquete/hoeveel.html is a wizard that generates a quastionaire. On the second page 'make_page.php' the user can fill out questions and select a response type for each question.
I want a different form to be loaded when each of the response type radio buttons is clicked, buy HOW???
I have seen a lot of examples on the internet using div, innerhtml and other Javscript functions, but i didn't get it to work. 🙁
A problem is that make_page.php is dynamically created by PHP, so any 'id' will have to be based on the variable $i from the for loop. Could someone help me out, or even code something for me? I know this isn't too hard, but i can't seem to figure out the right way to do it.
Thanks very much in advance!
<html>
<head>
<title>Questions</title>
<script language="Javascript">
function cell_create(row, r_type)
{
/* This function should decide what form to load in cell$i */
}
</script>
</head>
<body>
<?php
echo "<table bgcolor='#000000' cellpadding='4' cellspacing='1'><tr><td colspan='4' bgcolor='#f5f5f5'>Your questionaire will contain <b>$aantal</b> questions. Fill out the questions below and select a response type for every question </td></tr>";
echo "<tr bgcolor='#f5f5f5'><td><b>nr</b></td><td><b>question/statement</b></td><td><b>response type</b></td><td width=150><b>specify</b></td></tr>";
for($i=1; $i <=$aantal; $i++)
{
echo "<tr valign=\"top\" bgcolor='#f5f5f5'><td><b>$i</b></td>";
echo "<td><textarea name='vraag$i' rows='4' cols='32'>Fill out question</textarea></td>";
echo "<td>
<input type='radio' name='type_vraag$i' value='type_open' onClick=\"cell_create($i, 1)\">open
<input type='radio' name='type_vraag$i' value='type_number' onClick=\"cell_create($i, 2)\">list of numbers
<input type='radio' name='type_vraag$i' value='type_word' onClick=\"cell_create($i, 3)\">list of words
</td>
<td nowrap id=cell$i>
/* This is where the form should be loaded, depending on what radio box was selected */
</form>
</td></tr>";
}
echo "</table>";
?>
</body>
</html>