<?php
include 'connect.php';
$name = $_POST['temp_name'];
$_SESSION['temp_name'] = $name;
for ($x=0; $x<$count; $x++) {
$ww = $_POST['question'][$x];
$q = "INSERT INTO templates (template_name, questions_ids) VALUES ('$name', '$ww')";
mysqli_query($connect, $q);
}
?>
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7 lt8"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8 lt8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8" />
<!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
<title>Ambassadors Management</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Ambassadors Management Tool" />
<meta name="keywords" content="ifs" />
<meta name="author" content="xziomas" />
<link rel="shortcut icon" href="">
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/animate-custom.css" />
</head>
<body>
<div class="container">
<header>
<h1><span>Template Creation Tool</span></h1>
</header>
<section>
<div id="container_demo" >
<!-- hidden anchor to stop jump <a href="http://www.css3create.com/Astuce-Empecher-le-scroll-avec-l-utilisation-de-target#wrap4" target="_blank">http://www.css3create.com/Astuce-Empecher-...de-target#wrap4</a> -->
<a class="hiddenanchor" id="toregister"></a>
<a class="hiddenanchor" id="tologin"></a>
<div id="wrapper" >
<div id="login" class="animate form">
<form method="post" action="cr_temp_save2.php" autocomplete="off">
<h1>Choose positions for questions</h1>
<p>
<?php
$q = "SELECT * FROM templates WHERE template_name ='$name'";
//echo $q;
$sql = mysqli_query($connect, $q);
$questions_num = mysqli_num_rows($sql);
$i = 1;
while ($r = mysqli_fetch_assoc($sql)) {
$question_id[$i] = $r['questions_ids'];
//echo $question_id[$i];
$i++;
}
foreach ($question_id as $value) {
$temp_query = "SELECT * FROM questions WHERE questions_id = $value";
$temp_sql = mysqli_query($connect, $temp_query);
$result = mysqli_fetch_assoc($temp_sql);
$temp_question = $result['question'];
echo $temp_question." "."<select name='$value' value=''><option value='".$x."'>".$x."</option>"; for ($x=1;$x<$count;$x++) {
echo "<option value='".$x."'>".$x."</option>"; }
}
?></p>
<p class="login button">
<input type="submit" value="Save TEMPLATE" />
</p>
</form>
</div>
</div>
</div>
</section>
</div>
</body>
</html>
<?php/*
$url = 'template_list.php';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
*/
?>