| 
	
 | 
 Posted by SUtrap on 04/11/07 10:21 
Hi, 
 
I've done something similar some time ago, but my structure was a bit 
different (I wanted to be very flexible): 
1. I used an array to have all questions saved, like: 
   $question[x]="Question X"; Also all other values (your radio 
values) were saved as arrays! 
   That way you dont have to look at the whole page to change some 
text! My page was in english, german and french, so I had three files 
each for one language. 
2. I've used functions to generate the questions, like 
getQuestion($number), which returned the whole question + html string 
for the buttons. 
 
3. I've never used empty() call, only isset(); As far as I know it 
wont write any warning about unset variables. dont know if empty() 
does the same. 
4. Dont save $Variable1=$_POST['Variable1']; ! As long as you dont 
manipulate the data you dont need this! 
 
5. Most of your html code is the same only the values change. you 
could use such code: 
 
.....html stuff... 
<?php for($i=0;$i<sizeof($questions);$i++) { ?> 
---- your question x, as function or embedded php ---- 
<?php } ?> 
.....html stuff..... 
 
6. Maybe you can also separate the html stuff completely from PHP, 
with SMARTY or other template. 
 
I hope that gives you some hints ;)
 
  
Navigation:
[Reply to this message] 
 |