troubleshooting Question

Separating form quetionnumber | type | value HELP! using PHP

Avatar of Steve Tinsley
Steve TinsleyFlag for United Kingdom of Great Britain and Northern Ireland asked on
HTMLPHPjQuery
9 Comments1 Solution358 ViewsLast Modified:
I am creating a survey form which will have several different types of questions (freetext, slider1-10, multiple choice).

I need a way of recording in the database the question type.

An example form:

<input type="text" name="1731|textarea">
<input type="hidden" name="32|multichoice">
<input type="hidden" name="108|slider">
 
I then use PHP to separate questionnumber|questiontype using the pipe (|)
$question = explode("|", $question);
$questionID = $question[0];
$questionType = $question[1];

One of the problems I have is if someone uses the pipe (|) within the textbox it causes me problems. Also if the user has the option of multiple choice selecting several options i may seperate the value in a similar way (value="3|13|21").

I know this isn't the best way to achieve what I want but don't know another method.

Could someone help.

Thanks

Steve
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros