Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FRONT
- <?php
- $post = 'name='.$name;////(set name above))
- $url = "#######/Middle/chooseTestMiddle.php";
- $ch = curl_init();//initialize
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURL_POST, true); //true = 1
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);//post is the date of name value pair
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//get data bak = true
- $response = curl_exec($ch); //execute and get back data
- curl_close($ch);// close all curl connections
- $a = json_decode($response);
- var_dump($a);
- ?>
- <?php
- // $result = $a[0][0];
- // $onoroff = $a[1];
- // echo $result;
- if(mysqli_num_rows($result)>0)
- {
- while($row = mysqli_fetch_assoc($result))
- {
- echo '<form action="takeTest.php" method = "post" role="form"><button '.$onoroff.' class="btn-xl btn-info" id="box" type="submit" name = "submit"><input type="hidden" name = "theExam" value ="'.$row[ExamName].'"></input><span style="font-size:40px; font-family: kodakku;" >'.$row[ExamName].'</span></button></form><br />';
- }
- }
- ?>
- BACK
- <?php
- include ('dbconnect.php');
- $name = $_POST['name'];
- $a = "SELECT *
- FROM studentExams
- WHERE Username = '$name'";
- $b = mysqli_query($dbCon, $a);
- $c = mysqli_fetch_row($b);
- $allPoints = $c[2]; //there is an answer1
- if ($allPoints != "")
- $onoroff = "disabled";
- else
- $onoroff = " ";
- $sql = "SELECT ExamName FROM teacherExams";
- $result = mysqli_query($dbCon, $sql);
- $theArray = array($result, $onoroff);
- echo json_encode($theArray);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement