-
Notifications
You must be signed in to change notification settings - Fork 0
/
master_slot.php
68 lines (62 loc) · 2.32 KB
/
master_slot.php
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
<?php
include 'page_header.php';
echo "<form name=form1 id=form1 method=post>";
if(!empty($_POST['submit_btn']))
{
$sms_slot=$_POST['sms_slot'];
$phone_number=$_POST['phone_number'];
$select="select slot_id from sms_slot_file order by slot_id desc limit 1";
$result = $conn->query($select);
$row = $result->fetch_assoc();
$slot_id=$row['slot_id']+1;
$result=insertMaker('sms_slot_file',array('slot_id','sms_slot','phone_number'),array($slot_id,$sms_slot,$phone_number));
echo "<script>alert('Successfully Added New SMS Slot');
document.getElementById('form1').action = 'sms_slot_list.php';
document.form1.submit();
</script>";
}
if(!empty($_POST['update_btn']))
{
$sms_slot=$_POST['sms_slot'];
$phone_number=$_POST['phone_number'];
$slot_id=$_POST['slot_id'];
$result=updateMaker('sms_slot_file',array('sms_slot','phone_number'),array($sms_slot,$phone_number)," where slot_id='$slot_id'");
// echo $result;
echo "<script>alert('Successfully Updated New SMS Slot');
document.getElementById('form1').action = 'sms_slot_list.php';
document.form1.submit();
</script>";
}
$trans_num="";
$sms_slot="smsc";
$phone_number="";
if(!empty($_REQUEST['trans_num']))
{
$slot_id=$_REQUEST['trans_num'];
$select="select sms_slot,phone_number from sms_slot_file where slot_id='$slot_id' limit 1";
$result = $conn->query($select);
$row = $result->fetch_assoc();
$sms_slot=$row['sms_slot'];
$phone_number=$row['phone_number'];
echo "<input type='hidden' id='slot_id' name='slot_id' value='$slot_id'>";
}
?>
<table style='width:400px' class='form_css'>
<tr>
<th style='text-align:left'><h2>SMS Slot</h2></th>
</tr>
<?php
echo textMaker('SMS Slot','sms_slot',$sms_slot);
echo textMaker('Phone Number','phone_number',$phone_number);
echo "<tr>";
echo "<td colspan=2 style='text-align:center'>";
if(empty($_REQUEST['trans_num']))
echo "<input type='Submit' name='submit_btn' value='Submit' style='margin:15px'>";
else
echo "<input type='submit' name='update_btn' value='Update' style='margin:15px'>";
echo "<input type='button' value='Cancel' style='margin:15px'>";
echo "</td>";
echo "</tr>";
?>
</table>
</form>