1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| $wish_details = $wpdb->get_results("SELECT wish, details FROM SUB_CATEGORIE_WISH_DETAILS WHERE ID_sub_categorie=".$_GET['sub_cat']." AND translate = '$language'");
$questions = $wpdb->get_results("SELECT QUESTION.Question,QUESTION.ID_question, SUB_CATEGORIE_QUESTION.ID_sub_categorie, ANSWER.answer
FROM QUESTION
INNER JOIN SUB_CATEGORIE_QUESTION ON QUESTION.ID_question = SUB_CATEGORIE_QUESTION.ID_question
AND SUB_CATEGORIE_QUESTION.ID_sub_categorie = $id_sub_cat
INNER JOIN QUESTION_ANSWER ON QUESTION_ANSWER.ID_question = QUESTION.ID_question
INNER JOIN ANSWER ON QUESTION_ANSWER.id_answer = ANSWER.id_answer");
foreach ($wish_details as $datum) {
$wish = $datum->wish;
$details = $datum->details;
}
if(isset($_GET['find_options']) == "Find"){
?>
<form id="request" name="request" method="post">
<tr class="row-wish">
<th scope="row">
<label for="wish"><?php echo $wish." :"?></label>
</th>
<td>
<textarea name="Activity_Description" id="Activity_Description" class="regular-text"
placeholder="<?php _e('Enter a description of your wish') ?>"></textarea>
</td>
</tr>
<tr class="row-wish">
<th scope="row">
<label for="wish"><?php echo $details." :"?></label>
</th>
<td>
<textarea name="Activity_Description" id="Activity_Description" class="regular-text"
placeholder="<?php _e('Give more details') ?>"></textarea>
</td>
</tr>
<?php
foreach ($questions as $item) {
$question_name = $item->Question;
$question_id = $item->ID_question;
$answer = $item->answer;
if($answer == "YES/NO"){
?>
<label><?php echo $question_name ?></label>
<select name="answer_yes/no" id="answer_yes/no">
<option value="YES">YES</option>
<option value="NO">NO</option>
</select>
<?php
}
else if($answer == "TEXT"){
?>
<label><?php echo $question_name ?></label>
<input type="text" name="text">
<?php
}
else if($answer == "NUMBER"){
?>
<label><?php echo $question_name ?></label>
<input type="number" name="number">
<?php
}
else if($answer == "DATE"){
?>
<label><?php echo $question_name ?></label>
<input type="date" name="date">
<?php
}
else{
?>
<label><?php echo $question_name ?></label>
<select name="select_content" id="select_content/no">
<option value="<?php echo $answer ?>"><?php echo $answer ?></option>
</select>
<?php
}
} |
Partager