douba1498 2017-02-02 09:07
浏览 39

表格提交与会议

I have a problem with not getting the input values when I submit the form.

With this code there is an overview of domein records, with the ID it reads which one it will edit.

I have to get the values in a $_SESSION wen press edit.

<?php
require_once("classes/Login.php");
require_once("classes/versio.class.php");
require_once("config/config.php");
require_once("includes/includes.php");
require_once("includes/bootstrap.php");
require_once("includes/header.php");

if($login->isUserLoggedIn() != true) {
    header("Location: ./login.php");
}

$domain = $_GET['domain'];
$tld = $_GET['tld'];

unset($command);
$command = array(
    "command" => "DomainsDNSListRecords",
    "domain" => $domain,
    "tld" => $tld
);

$api = new Versio_api();
$versio = $api->api_send($command);

if($versio['success']==0) {
    echo("Fout opgetreden. Fout code: ".$versio['command_response_code'].". Fout text: ".$versio['command_response_message']."");
}
else {
    if($versio['total_count']>0)
    {
require_once("includes/submenu.php");

if(isset($_POST['submit'])) {
    $_SESSION["name"] = $_POST['rName'];
    $_SESSION["type"] = $_POST['rType'];
    $_SESSION["value"] = $_POST['rVal'];
    $_SESSION["prio"] = $_POST['rPrio'];
    $_SESSION["ttl"] = $_POST['rTtl'];
}

?>
    <div class="col-sm-9 col-md-9">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">Klantenpaneel</h3>
        </div>
        <div class="panel-body">
            <form method="post" action="">
                <table class="table table-striped">
                    <thead>
                        <tr>
                        <th>Naam</th>
                        <th></th>
                        <th>Type</th>
                        <th></th>
                        <th>Waarde</th>
                        <th></th>
                        <th>Prioriteit</th>
                        <th></th>
                        <th>TTL</th>
                        <th></th>
                      </tr>
                    </thead>
                    <table class="table table-striped table-bordered">
                    <tbody>
<?php
    $teller = 1;
    while($versio['total_count']>=$teller) {
?>
                      <tr>
                        <td><input class="table-input" type="text" name="rName" value="<?php echo $versio['name_'.$teller]; ?>"></td>
                        <td><select class="table-input" name="rType">
                            <option value="<?php echo $versio['type_'.$teller]; ?>"><?php echo $versio['type_'.$teller]; ?></option>
                            <option value="A">A</option>
                            <option value="MX">MX</option>
                            <option value="CNAME">CNAME</option>
                            <option value="SRV">SRV</option>
                            <option value="TXT">TXT</option>
                            <option value="SPF">SPF</option>
                        </select></td>
                        <td><input class="table-input" type="text" name="rVal" value="<?php echo $versio['value_'.$teller]; ?>"></td>
                        <td><input class="table-input" type="text" name="rPrio" value="<?php echo $versio['prio_'.$teller]; ?>"></td>
                        <td><select class="table-input" type="text" name="rTtl">
<?php
    $_SESSION["ttl"] = $versio['ttl_'.$teller];
    $getal = $_SESSION["ttl"];
    $_60 = 60;
    $uitkomst = $getal / $_60 / $_60;
    echo $uitkomst;
?>
                            <option value="<?php echo $versio['ttl_'.$teller]; ?>"><?php echo $uitkomst ?> uur</option>
                            <option value="300">5 min</option>
                            <option value="3600">1 uur</option>
                            <option value="7200">2 uur</option>
                            <option value="14400">4 uur</option>
                            <option value="28800">8 uur</option>
                            <option value="86400">24 uur</option>
                            </select>
                        </td>
                        <td style="width: 10px;"><a href="edit.record.php?id=<?php echo $versio['id_'.$teller]; ?>&tld=<?php echo $tld ?>&domain=<?php echo $domain ?>" style="color:blue; text-decoration:none;" 
                               onclick="return confirm('Are you sure you want to Edit this item?');">
                        <p class="glyphicon glyphicon-pencil text-primary" type="submit" name="submit"></p></a></td>
                        <td style="width: 10px;"><a href="remove.record.php?id=<?php echo $versio['id_'.$teller]; ?>&tld=<?php echo $tld ?>&domain=<?php echo $domain ?>" style="color:red; text-decoration:none;" 
                               onclick="return confirm('Are you sure you want to delete this item?');">
                        &#10008;</a></td>
                      </tr>
<?php                  $teller++;
}
?>
                    </tbody>
                </table>
                <a href="add.record.php?domain=<?php echo $domain ?>&tld=<?php echo $tld ?>">
                        Record toevoegen</a>
            </form>
        </div>
    </div>
<?php
    } else {
        echo("Er zijn geen DNS records gevonden voor dit domein.");
    }
}
?>

<?php require_once("includes/footer.php"); ?>

<?php
require_once("classes/versio.class.php");

$domain = $_GET['domain'];
$tld = $_GET['tld'];
$id = $_GET['id'];

unset($command);
$command = array(
    "command" => "DomainsDNSDeleteRecord",
    "domain" => $domain,
    "tld" => $tld,
    "id" => $id
); 
 
    $api = new Versio_api();
    $versio = $api->api_send( $command );
 
if($versio['success']==0) {
    echo("Fout opgetreden. Fout code: ".$versio['command_response_code'].". Fout text: ".$versio['command_response_message']."");
} else {

    unset($command);
    $command = array(
        "command" => "DomainsDNSAddRecord",
        "domain" => $domain,
        "tld" => $tld,
        "name" => $_SESSION['name'],
        "type" => $_SESSION['type'],
        "value" => $_SESSION['value'],
        "prio" => $_SESSION['prio'],
        "ttl" => $_SESSION['ttl']
    );

        $api = new Versio_api();
        $versio = $api->api_send($command);

        if($versio['success']==0) {
            echo("Fout opgetreden. Fout code: ".$versio['command_response_code'].". Fout text: ".$versio['command_response_message']."");
            
        }else{
            header ("location: records.php?domain=$domain&tld=$tld");
        }
} 
?>

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 msix packaging tool打包问题
    • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线