Hi,
I've tried fixing this myself, but no joy 🙁
All I can think is to offer the problem to you guys and hope that someone can crack it. The first to do so wins a sadgeezer t-shirt of baseball cap - Hey, don't scoff, they're quite rare! 😃
Can anyone help me with a simple php script which would do the same?
The script is called from the following form tag:
<form action="http://www.affinity-intranet.org.uk/test.asp" method="post">
<input type="hidden" name="header-0-28" value="http://www.sadgeezer.com/babylon5/twerp.htm">
<input type="hidden" name="header-29-38" value="http://www.sadgeezer.com/babylon5/sad.htm">
<input type="hidden" name="header-39-99" value="http://www.sadgeezer.com/babylon5/manic.htm">
There are 15 questions. Each question is multiple choice and has three different options (radio butttons) eg.:
<input type="radio" name="1" value="1">
Note: Each option has the same 'name' and value is either 1, 2 or 3 depending on the validity of the answer. The 'name' changes for each question number so an example of one of the options for question 14 would be:
<input type="radio" name="14" value="1">
At the end of the form there is a 'Rate Me' and a 'Start Again' button:
<input type="submit" value="Rate Me">
<input type="reset" value="Start Again">
</form>
Once the rate me button is pressed, the script below calculates the totals of each question (ie. it adds up all the 1's 2's and 3's from all the questions and sends the answer back to the form. Sounds simple huh? 🙁
ASP Script called 'test.asp'
<% result=0
for each Item in Request.Form
if isNumeric(Item) then
result=result+Request.Form(Item)
end if
next
if result<=28 then
redirect=request.form("header-15-28")
elseif result>28 and result<39 then
redirect=request.form("header-29-38")
else
redirect=request.form("header-39-45")
end if
response.redirect(Server.MapPath(redirect))
%>
Please would someone show me a simple php script that could replace the 'test.asp' script and allow me to leave the html tags in my files.
Reason I need the script? - I run the site sadgeezer.com with lots of cult TV sci fi resources including a large number of Purity Tests. Now that I'm all PHP (thank goodness!) my host doesn't have ASP. therefore the Tests don't work and my members and visitors are annoyed 🙁
An example if the Test is at:
http://www.sadgeezer.com/html/Sections+index-req-viewarticle-artid-58-page-1.html
But of course, it doesn't work now.
Any help would be hugely appreciated - I'll even send the first person to crack the problem a sadgeezer.com t-shirts or baseball cap 🙂