dodanie wybrania ucznia
This commit is contained in:
parent
f3174a810f
commit
524ec65b7d
@ -1,56 +1,26 @@
|
||||
<?php header('Access-Control-Allow-Origin: *'); ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
table {
|
||||
<body style="background-color:powderblue;">
|
||||
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table, td, th {
|
||||
border: 1px solid black;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
th {text-align: left;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
$q = intval($_GET['q']);
|
||||
|
||||
$con = mysqli_connect('mysql49.mydevil.net','m1344_dziennik','Julian2020!','m1344_dziennik');
|
||||
if (!$con) {
|
||||
die('Could not connect: ' . mysqli_error($con));
|
||||
}
|
||||
|
||||
mysqli_select_db($con,"ajax_demo");
|
||||
$result = $con->query("select id_account, firstName, surName from accounts");
|
||||
echo "<html>";
|
||||
echo "<body>";
|
||||
echo "<select name='id'>";
|
||||
|
||||
$sql = "SELECT a1.firstName as imie, a1.surName as nazwisko, u1.tresc as tresc FROM accounts as a1\n"
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
|
||||
. "LEFT JOIN uwagi as u1 ON a1.id_account = u1.id_account";
|
||||
unset($id_account, $firstName, $surName);
|
||||
$id_account = $row['id_account'];
|
||||
$firstName = $row['firstName'];
|
||||
$surName = $row['surName'];
|
||||
echo'<option value="'.$id_account.'">'.$firstName.' '.$surName.'</option>';
|
||||
|
||||
$result = mysqli_query($con,$sql);
|
||||
echo "<table>
|
||||
<tr>
|
||||
<th>Treść</th>
|
||||
<th>Nazwisko</th>
|
||||
<th>Treść></th>
|
||||
</tr>";
|
||||
while($row = mysqli_fetch_array($result)) {
|
||||
echo "<tr>";
|
||||
echo "<td>" . $row['imie'] . "</td>";
|
||||
echo "<td>" . $row['nazwisko'] . "</td>";
|
||||
echo "<td>" . $row['tresc'] . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</select>";
|
||||
echo "</body>";
|
||||
echo "</html>";
|
||||
?>
|
||||
|
||||
echo "</table>";
|
||||
mysqli_close($con);
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
33
public_html/wtf.php
Normal file
33
public_html/wtf.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
$id=$_GET['id'];
|
||||
//$id1=$_SESSION['id']; COMMENTED THIS AS I AM NOT IN SESSION. HARDCODED IT IN THE FORM AS VALUE 5
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post" class="msgfrm" id="msgfrm">
|
||||
<input type="hidden" value="<?php echo $_GET['id']; ?>" name="rcvrid" id="rcvrid">
|
||||
<input type="hidden" name="senderid" id="senderid" value="5" >
|
||||
<div class="msgdiv" id="chatbox"></div>
|
||||
<div class="textdiv">
|
||||
<input type="text" name="msg" id="msg" class="textmsg">
|
||||
<input type="submit" value="Send" >
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
$("#msgfrm").on("submit", function(event) {
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "msg_save.php",
|
||||
data: $(this).serialize(),
|
||||
success: function(data) {
|
||||
$("#chatbox").append(data+"<br/>");//instead this line here you can call some function to read database values and display
|
||||
},
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user