Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //update proccess
- <?php
- $serverName = "localhost";
- try{
- $db= new PDO( "sqlsrv:server=$serverName ; Database=systems_requests", "test", "test");
- $db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
- $sql = 'UPDATE requests Set name= :name, lanId= :lanId, department= :department,manager= :manager,request= :request,request_comments= :request_comments,status= :status,comments= :comments,compUser= :compUser, compDt= :compDt WHERE id= :id';
- $stmt = $db->prepare($sql);
- $stmt->bindParam(':id', $_POST['id'], PDO::PARAM_INT);
- $stmt->bindParam(':lanId', $_POST['lanId'], PDO::PARAM_STR);
- $stmt->bindParam(':name', $_POST['name'], PDO::PARAM_STR);
- $stmt->bindParam(':department', $_POST['department'], PDO::PARAM_STR);
- $stmt->bindParam(':manager', $_POST['manager'], PDO::PARAM_STR);
- $stmt->bindParam(':request', $_POST['request'], PDO::PARAM_STR);
- $stmt->bindParam(':request_comments', $_POST['request_comments'], PDO::PARAM_STR);
- $stmt->bindParam(':status', $_POST['status'], PDO::PARAM_STR);
- $stmt->bindParam(':comments', $_POST['comments'], PDO::PARAM_STR);
- $stmt->bindParam(':compUser', $_POST['compUser'], PDO::PARAM_STR);
- $stmt->bindParam(':compDt', $_POST['compDt'], PDO::PARAM_INT);
- $stmt->execute();
- $to = $_POST['lanId'] . "@exchange.test.com";
- $subject = "Request";
- $headers = "From: test@test.com";
- $message ="LanID: " . $_POST['lanId'] . "
- " ."User Name: ". $_POST['name'] ."
- ". "Department: " . $_POST['department'] . "
- " ."Manager: ". $_POST['manager'] . "
- ". "User Request: " . $_POST['request'] . "
- " ."User Request comments: ". $_POST['request_comments']. "
- " ."Status: " . $_POST['status'] . "
- " ."Systems comments: ". $_POST['comments'] . "
- " ."Completed by: ". $_POST['compUser'] ;
- mail($to,$subject,$message,$headers);
- }catch(PDOException $exception){
- echo "Error: " . $exception->getMessage();
- }
- ?>
- //start of form to select the id to update
- <?php
- include('db_connect.php');
- $id=$_GET['id'];
- $result = $db->prepare("SELECT * FROM requests WHERE id= :id");
- $result->bindParam(':id', $id);
- $result->execute();
- for($i=0; $row = $result->fetch(); $i++){
- ?>
- <html>
- <head>
- <title></title>
- <style type="text/css">
- }
- .body{
- background-color: #F2F2F2;
- border: thin solid #666666;
- }
- </style>
- </head>
- <body class='body'>
- <form action = "update_process.php" method ="post" class="Form">
- <p><input type ="hidden" name = "id" value="<?php print($id); ?>"</p>
- <h2 align="center">Users request Information</h2>
- <table border='1' align="center">
- <tr>
- <td>LAN ID:</td>
- <td><input type="text" value ="<?php print($row['lanId']) ?>"name="lanId"></td>
- <td>Name:</td>
- <td><input type="text" value ="<?php print($row['name']) ?>"name="name"></td>
- </tr>
- <tr>
- <td>Department Location</td>
- <td><input type="text" value ="<?php print($row['department']) ?>"name="department"></td>
- <td>Manager</td>
- <td><input type="text" value ="<?php print($row['manager']) ?>"name="manager"></td>
- </tr>
- <tr>
- <td>Request</td>
- <td><input type="text" value ="<?php print($row['request']) ?>"name="request"></td>
- <td></td>
- <td></td>
- </tr>
- </table>
- <h2 align='center'>Requested Comments</h2>
- <table border='1' align="center">
- <tr>
- <td width='400' height="40">
- <textarea name="request_comments" style="width: 600px; height: 81px" style="text-transform:uppercase ;"><?php echo $row['request_comments']; ?></textarea></td>
- </tr>
- </table>
- <h2 align="center">Complete or Update Requests Status</h2>
- <table border='1' align="center" style="width: 595px">
- <tr>
- <td>Completed Date</td>
- <td style="width: 303px">
- <input type="text" value ="<?php echo date("m/d/Y",time())?>"name="compDt" style="width: 148px"></td>
- </tr>
- <tr>
- <td>Status</td>
- <td style="width: 303px"><select name ="status" style="width: 149px" >
- <option value <?php if ($row['status']==1){ print('selected');} ?> ="Received">Received</option>
- <option value <?php if ($row['status']==2){ print('selected');} ?> ="Completed">Completed</option>
- <option value <?php if ($row['status']==3){ print('selected');} ?> ="Cancelled">Cancelled</option>
- <option value <?php if ($row['status']==4){ print('selected');} ?> ="In_Progress">In_Progress</option>
- <option value <?php if ($row['status']==5){ print('selected');} ?> ="On_Hold">On_Hold</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Completed by</td>
- <td style="width: 303px"><select name ="compUser" style="width: 149px" >
- <option value <?php if ($row['compUser']==1){ print('selected');} ?> ="">Please Select....</option>
- <option value <?php if ($row['compUser']==1){ print('selected');} ?> ="xgrh">xgrh</option>
- <option value <?php if ($row['compUser']==2){ print('selected');} ?> ="zeap">zeap</option>
- <option value <?php if ($row['compUser']==2){ print('selected');} ?> ="xjae">xjae</option>
- <option value <?php if ($row['compUser']==5){ print('selected');} ?> ="zmoj">zmoj</option>
- </select>
- </td>
- </tr>
- </table>
- <div align='center'>
- <br>Systems Support Comments:<br>
- <textarea name="comments" Value = "<?php print($row['request_comments']) ?>" style="width: 593px; height: 90px"></textarea><br>
- <br>
- <input type="submit" value= "Update Information">
- <br>
- </div>
- </form>
- </body>
- </html>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement