Server IP : 202.29.229.35 / Your IP : 3.129.22.159 Web Server : Apache System : Linux aapanel2 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 User : www ( 1001) PHP Version : 5.5.38 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/www.ivecr2.ac.th/stdcard/checkstdnew/ |
Upload File : |
<?php error_reporting(0); include ('../connect/connect.php'); if($_GET['id'] != '' && $_GET['id'] != NULL){ $sql = "SELECT * FROM tblstd_idcard WHERE student_id = '".$_GET['id']."'"; $query = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($query) != 1){ $data_form = false; } $data_form = mysql_fetch_assoc($query); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Edit date</title> <link rel="icon" href="Blooper.ico"> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> <style> .container{ width:70%; margin-top:10px; margin-left:auto; margin-right:auto; } </style> </head> <body> <div class="container"> <?php if($_POST['update'] == 1){?> <div class="page-header"> <h1>แก้ไขข้อมูลนักศึกษา<small></small></h1> </div> <?php //var_dump($_POST['data']); //echo $_POST['data']['\'student_id\'']; //exit(); foreach ($_POST['data'] as $key => $value) { $set[]= str_replace("'","", $key)."='".$value."'"; } $sql_update = "UPDATE tblstd_idcard SET ".implode(",",$set)." WHERE student_id = '".$_POST['where']."'"; //echo $sql_update; //exit(); $query_update = mysql_query($sql_update) or die(mysql_error()); if($query_update){ ?> <div class="alert alert-success" role="alert">แก้ไขข้อมูลเรียบร้อยแล้ว</div> <META HTTP-EQUIV="Refresh" CONTENT="2;URL=index.php?q=<?php echo $_POST['data']['\'student_id\''];?>"> <!--<META HTTP-EQUIV="Refresh" CONTENT="2;URL=index.php">--> <?php }else{ ?> <div class="alert alert-danger" role="alert">ไม่สามารถแก้ไขข้อมูลนักศึกษาได้</div> <?php } $data_form = false; }?> </div> <?php if($data_form !== false){?> <!-- form edit --> <div class="container"> <div class="page-header"> <h1>แก้ไขข้อมูลนักศึกษา <small> <?php echo $data_form['student_id'];?></small></h1> </div> <form action="" method="POST" class="form-horizontal" role="form"> <?php foreach ($data_form as $key => $value) {?> <div class="form-group"> <label for="inputEmail3" class="col-sm-2 control-label"><?php echo $key;?></label> <div class="col-sm-10"> <input type="test" name="data['<?php echo $key;?>']" value="<?php echo $value;?>" class="form-control" id="inputEmail3" placeholder=""> </div> </div> <?php } //end foreach?> <input type="hidden" name="where" value="<?php echo $data_form['student_id'];?>"> <input type="hidden" name="update" value="1"> <div class="form-group"> <div class="col-sm-10 col-sm-offset-2"> <button type="submit" class="btn btn-primary">Submit</button> <a href="index.php "><button type="button" class="btn btn-success">Home</button></a> </div> </div> </form> </div> <?php }//end if ?> </body> </html>