HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/company_app/company/edit.php
<?php 
if (session_status() == PHP_SESSION_NONE) {
    session_start();
 }
require '../include/functions.php'; 
if(!isset($_SESSION["email"]))
{
   header('Location: '.getParentDir().'/index.html');
}
 
$company_id = isset($_GET['company_id']) ? $_GET['company_id'] : '';
global $conn;
$sql = "SELECT * FROM companies where company_id = '$company_id' order by id desc limit 0,1";
$result = $conn->query($sql);
$company_id = '';
$company_name = '';
$scheduler_time='';
$end_url = '';
$status = '';
if ($result->num_rows > 0) {
    // output data of each row
    $k=1;
    while($row = $result->fetch_assoc()) 
    {
        $company_id = $row['company_id'];
        $company_name = $row['company_name'];
        $scheduler_time = $row['scheduler_time'];
        $end_url = $row['end_url'];
        $status = $row['status'];
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Add company | API</title>

    <?php include '../include/head.php'; ?>
   
</head>

<body>
    <div id="wrapper">
        <!-- Navigation -->
        <?php include '../include/sidenav.php'; ?>
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header">Campany Add</h1>
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->
                <div class="row">
                    <div class="col-lg-6">
                    <form role="form" method="post" action="<?php echo getParentDir();?>/include/functions.php?option=edit_company">
                    <input type="hidden" name="company_id" value="<?php echo $company_id; ?>">
                        <div class="form-group">
                            <label>Company ID</label>
                            <input class="form-control" placeholder="Enter Company ID" name="company_id" value="<?php echo $company_id; ?>" onkeypress='return formats(this,event)' onkeyup="return numberValidation(event)" required>
                            <p class="help-block">Ex: 0000-0000-0000-0000</p>
                        </div>
                        <div class="form-group">
                            <label>Company Name</label>
                            <input class="form-control" placeholder="Enter Company Name" name="company_name" value="<?php echo $company_name; ?>" required>
                            <p class="help-block">Ex: xyz</p>
                        </div>
                        <div class="form-group">
                            <label>Salesforce API End URL</label>
                            <input class="form-control" placeholder="Enter API End URL" name="end_url" value="<?php echo $end_url; ?>" required>
                            <p class="help-block">Ex: https://login.salesforce.com</p>
                        </div>
                        <div class="form-group">
                            <label>Scheduler Time (In Sec)</label>
                            <select class="form-control" name="scheduler_time" required>
                                <option value="">Select scheduler time</option>
                                <?php
                                    for($h=1; $h <= 3600; $h++)
                                    {
                                        ?>
                                        <option <?php if($h == $scheduler_time) { ?>selected<?php } ?> value="<?php echo $h; ?>"><?php echo $h." (Sec)"; ?></option>
                                        <?php        
                                    }
                                ?>
                                 
                            </select>
                             
                        </div>
                        <div class="form-group">
                            <label>status</label>
                            <select class="form-control" name="status" required>
                                <option value="">Select Status</option>
                                <option <?php if($status == '1') { ?>selected<?php } ?> value="1">Activated</option>
                                <option <?php if($status == '0') { ?>selected<?php } ?> value="0">Deactivated</option>
                            </select>
                             
                        </div>
                        <br/>
                        <button type="submit" class="btn btn-primary">Update</button>                        
                    </form>
                    <?php
                    
                    ?>
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->                 
            </div>
            <!-- /.container-fluid -->
        </div>
        <!-- /#page-wrapper -->
    </div>
    <!-- /#wrapper -->    
    <?php include '../include/footer.php'; ?>
    <script>
      function formats(ele,e){
        if(ele.value.length<19){
          ele.value= ele.value.replace(/\W/gi, '').replace(/(.{4})/g, '$1 ');
          return true;
        }else{
          return false;
        }
      }
      
      function numberValidation(e){
        e.target.value = e.target.value.replace(/[^\d ]/g,'');
        return false;
      }
    </script>
</body>
</html>