Q695 Posted February 11, 2009 Share Posted February 11, 2009 This code is copying the data from the previous query for some reason, and changing the type of field produced: <?php $type=$_GET[type]; ?> <form action="?page=construction_type&type=<?php echo $type;?>" method="post"> <strong>Zip/Postal Code:</strong> <br> <input type="text" name="zip"> <?php $sql="SELECT * FROM criteria WHERE type='$type' AND rank<'10';"; $result=@mysql_query($sql,$con) or die(death($sql)); while ($row=mysql_fetch_array($result)){ ///////////////////////////////////////////////////////////////////////////// echo "<p><strong>".$row[value].":</strong><br>"; //////////////////////////////////////////////////////////////////////////// $sql2="SELECT * FROM criteria WHERE question='$row[question]' AND rank='10';"; $result2=@mysql_query($sql2,$con) or die(death($sql2)); while ($row2=mysql_fetch_array($result2)){ $style=$row['style']; switch ($style) { case 1: $field=" $row2[value]:<br><input type='radio' name='$row[value]' value='$row2[value]'>"; break; case 2: $field="<input type='text' name='$row[value]' > $row2[value]"; break; case 3: $field="<input type='checkbox' name='$row[value]' value='$row2[value]'> $row2[value]"; break; case 4: $field="<textarea name='$row[value]'></textarea>"; break; } echo $field; } echo "</p>"; } ?> <p><strong>Expect:</strong><br> <textarea name="expect" cols="50" rows="10"></textarea></p> <input type="submit" value="Submit"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/144737-solved-creating-survey-from-database-bug/ Share on other sites More sharing options...
gevans Posted February 11, 2009 Share Posted February 11, 2009 I'm not sure I udnerstand, what's your input and expeected output? Which query is causing a problem, also using [ code] [ /code] tags will give you a nice easy to read bit of code; <?php echo 'like this'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/144737-solved-creating-survey-from-database-bug/#findComment-759557 Share on other sites More sharing options...
Q695 Posted February 11, 2009 Author Share Posted February 11, 2009 It was just my survey loading app error Quote Link to comment https://forums.phpfreaks.com/topic/144737-solved-creating-survey-from-database-bug/#findComment-759909 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.