Jump to content

Mouradsah

Members
  • Posts

    14
  • Joined

  • Last visited

Mouradsah's Achievements

Member

Member (2/5)

0

Reputation

  1. im so sorry yes i think that the get data contain a value but im not sur anymore
  2. function editDomaine($domain, $did_id, $port, $did_ivr_disable) { $clientid = getId(); if ($clientid == false) { return false; } if (!is_numeric($port)) { $port = '5060'; } if ($port == '') { $port = '5060'; } if ( ($port != '5060') && ($port != '5080') ) { return false; } $db = new mysqli('localhost', 'root', '', 'db'); if ($db->connect_errno) { die('<p>Connexion impossible : ' . $db->connect_error . '</p>'); } $domain = addslashes($domain); $did_id = addslashes($did_id); $port = addslashes($port); $did_ivr_disable = addslashes($did_ivr_disable); $query = "UPDATE a2billing.cc_did SET did_dom_name='$domain', did_dom_name_port='$port', did_ivr_disable='$did_ivr_disable' WHERE id='$did_id' "; if ($db->query($query)) { $db->close(); return true; } $db->close(); return false; } i use this
  3. the value from db is if disable is 0 or is enable is 1 the code should show me when i will edit the radio bouton should be exactly like is on db if on db is 0 it should No be checked or if is 1 the Yes button should be checked
  4. yes <?php require_once "api.php"; if (isAuth() == false) { header('Location: login.html'); } if (!isset($_GET['username']) || !isset($_GET['did']) || !isset($_GET['cid']) || !isset($_GET['serip']) || !isset($_GET['domaine']) || !isset($_GET['port']) || !isset($_GET['did_id'])) { header('Location: index.php'); } if (isset($_GET['dest'])) { $dest = $_GET['dest']; } else { $dest = ''; } if (isset($_GET['dest_id'])) { $dest_id = $_GET['dest_id']; } else { $dest_id = NULL; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <style> html, body { height: 100%; } body { display: -ms-flexbox; display: -webkit-box; display: flex; -ms-flex-align: center; -ms-flex-pack: center; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; padding-top: 40px; padding-bottom: 40px; background-color: #f5f5f5; } .form-edit { width: 100%; max-width: 330px; padding: 15px; margin: 0 auto; } .form-edit .form-control { position: relative; box-sizing: border-box; height: auto; padding: 10px; font-size: 16px; } .form-edit .form-control:focus { z-index: 2; } </style> <title>EDIT</title> </head> <body> <form class="form-edit" action="action.php" method="post"> <input type="hidden" name="username" value="<?php echo $_GET['username']; ?>" /> <input type="hidden" name="did" value="<?php echo $_GET['did']; ?>" /> <input type="hidden" name="cid" value="<?php echo $_GET['cid']; ?>" /> <input type="hidden" name="serip" value="<?php echo $_GET['serip']; ?>" /> <input type="hidden" name="did_id" value="<?php echo $_GET['did_id']; ?>" /> <input type="hidden" name="dest" value="<?php echo $dest; ?>" /> <?php if ($dest_id) { echo '<input type="hidden" name="dest_id" value="' . $_GET['dest_id'] . '" />'; } $PORT = $_GET['did_dom_name_port']; if (!is_numeric($PORT)) { $PORT = '5060'; } if ($_GET['username'] == '1387585776') { $PORT = '5080'; } if ($_GET['username'] == '2998208535') { $PORT = '5080'; } ?> <h1 class="h3 mb-3 font-weight-normal">Edit</h1> <label for="inputdomaine" class="sr-only">DOMAINE</label> <input value="<?php echo $_GET['domaine']; ?>" type="text" id="inputdomaine" class="form-control" name="domaine" placeholder="DOMAINE" autofocus> <label for="inputport">PORT (only 5060 or 5080)</label> <input value="<?php echo $_GET['port']; ?>" type="numeric" id="inputport" class="form-control" name="port" placeholder="PORT" autofocus> <p> </br> <th> Edit Answering Machine </th> <?php $did_ivr_disable = 0; $chk0 = $$did_ivr_disable==0 ? 'checked="checked"' : ''; $chk1 = $$did_ivr_disable==1 ? 'checked="checked"' : ''; echo "<input type='radio' name='did_ivr_disable' value='0' $chk0> No &emsp; <input type='radio' name='did_ivr_disable' value='1' $chk1> Yes"; ?> <label for="inputdest" class="sr-only">DESTINATION</label> <!-- <textarea rows="4" name="dest" id="inputdest" class="form-control" placeholder="DESTINATION"><?php echo $dest; ?></textarea> --> <button class="btn btn-lg btn-primary btn-block" type="submit">Edit</button> </form> <script src="https://code.jquery.com/jquery-3.5.1.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.minjs"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> </body> </html>
  5. I'm sorry I'm new to programming
  6. thank's but it show me Always 0 even is 1 on my bd
  7. no me I want that if in the database the answering machine is 1 it displays yes automatically checked if 0 it displays me not selected I want it to take the state from the database
  8. Hi everybody, here I come back because I did not find a solution to my problem.. in short I have two radio button which works well when inserting data on my database but I want when I return to the edition page I find the last one I checked or the state of the function from the database is it possible!!!! this is my Edit.php <?php require_once "api.php"; if (isAuth() == false) { header('Location: login.html'); } if (!isset($_GET['username']) || !isset($_GET['did']) || !isset($_GET['cid']) || !isset($_GET['serip']) || !isset($_GET['domaine']) || !isset($_GET['port']) || !isset($_GET['did_id'])) { header('Location: index.php'); } if (isset($_GET['dest'])) { $dest = $_GET['dest']; } else { $dest = ''; } if (isset($_GET['dest_id'])) { $dest_id = $_GET['dest_id']; } else { $dest_id = NULL; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <style> html, body { height: 100%; } body { display: -ms-flexbox; display: -webkit-box; display: flex; -ms-flex-align: center; -ms-flex-pack: center; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; padding-top: 40px; padding-bottom: 40px; background-color: #f5f5f5; } .form-edit { width: 100%; max-width: 330px; padding: 15px; margin: 0 auto; } .form-edit .form-control { position: relative; box-sizing: border-box; height: auto; padding: 10px; font-size: 16px; } .form-edit .form-control:focus { z-index: 2; } </style> <title>EDIT</title> </head> <body> <form class="form-edit" action="action.php" method="post"> <input type="hidden" name="username" value="<?php echo $_GET['username']; ?>" /> <input type="hidden" name="did" value="<?php echo $_GET['did']; ?>" /> <input type="hidden" name="cid" value="<?php echo $_GET['cid']; ?>" /> <input type="hidden" name="serip" value="<?php echo $_GET['serip']; ?>" /> <input type="hidden" name="did_id" value="<?php echo $_GET['did_id']; ?>" /> <input type="hidden" name="dest" value="<?php echo $dest; ?>" /> <?php if ($dest_id) { echo '<input type="hidden" name="dest_id" value="' . $_GET['dest_id'] . '" />'; } $PORT = $_GET['did_dom_name_port']; if (!is_numeric($PORT)) { $PORT = '5060'; } if ($_GET['username'] == '1387585776') { $PORT = '5080'; } if ($_GET['username'] == '2998208535') { $PORT = '5080'; } ?> <h1 class="h3 mb-3 font-weight-normal">Edit</h1> <label for="inputdomaine" class="sr-only">DOMAINE</label> <input value="<?php echo $_GET['domaine']; ?>" type="text" id="inputdomaine" class="form-control" name="domaine" placeholder="DOMAINE" autofocus> <label for="inputport">PORT (only 5060 or 5080)</label> <input value="<?php echo $_GET['port']; ?>" type="numeric" id="inputport" class="form-control" name="port" placeholder="PORT" autofocus> <p> </br> <th> Edit Answering Machine </th> </p> <form action="api.php" method="POST"> <div class="form-group mb-3"> </div> <div class="form-group mb-3"> <input type="radio" id="1" name="did_ivr_disable" value="1" /> <label for="did_ivr_disable">Enable</label> <input type="radio" id="0" name="did_ivr_disable" value="0" /> <label for="did_ivr_disable">Disable</label> <label for="inputdest" class="sr-only">DESTINATION</label> <!-- <textarea rows="4" name="dest" id="inputdest" class="form-control" placeholder="DESTINATION"><?php echo $dest; ?></textarea> --> <button class="btn btn-lg btn-primary btn-block" type="submit">Edit</button> </form> <script src="https://code.jquery.com/jquery-3.5.1.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.minjs"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> </body> </html>
  9. <th>USERNAME</th> <th>DID</th> <th>DOMAINE</th> <th>PORT</th> <th>Disable VNT Answering Machine</th> <th>ACTION</th> </tr> </thead> <tbody> <?php foreach (getDid() as $item) { echo " <tr> <td>" , $item['username'] , "</td> <td>" , $item['did'] , "</td> <td>" , $item['did_dom_name'] , "</td> <td>" , $item['did_dom_name_port'] , "</td> <td>" , $item['did_ivr_disable'] == (0) ? 'Disabled' : 'Enabled' ,"</td> <td> <a href='edit.php?username=" , $item[' username'] , "&did=" , $item['did'] , "&cid=" , $item['card_id'] , "&serip=" , $item['ser_ip_sip'] , "&domaine=" ,$item['did_dom_name'] , "&did_ivr_disable=", $item['did_ivr_disable'] , "&port=" , $item['did_dom_name_port'] , "&dest=" , $item['destination'] , "&did_id=" , $item['did_id'] , "&dest_id=" , $item['destination_id'] , "'>edit</a></td> </tr> " ; } ?> </tbody>
  10. this is my entire code <?php require_once "api.php"; if (isAuth() == false) { header('Location: login.html'); } if (!isset($_GET['username']) || !isset($_GET['did']) || !isset($_GET['cid']) || !isset($_GET['serip']) || !isset($_GET['domaine']) || !isset($_GET['port']) || !isset($_GET['did_id'])) { header('Location: index.php'); } if (isset($_GET['dest'])) { $dest = $_GET['dest']; } else { $dest = ''; } if (isset($_GET['dest_id'])) { $dest_id = $_GET['dest_id']; } else { $dest_id = NULL; } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <style> html, body { height: 100%; } body { display: -ms-flexbox; display: -webkit-box; display: flex; -ms-flex-align: center; -ms-flex-pack: center; -webkit-box-align: center; align-items: center; -webkit-box-pack: center; justify-content: center; padding-top: 40px; padding-bottom: 40px; background-color: #f5f5f5; } .form-edit { width: 100%; max-width: 330px; padding: 15px; margin: 0 auto; } .form-edit .form-control { position: relative; box-sizing: border-box; height: auto; padding: 10px; font-size: 16px; } .form-edit .form-control:focus { z-index: 2; } </style> <title>EDIT</title> </head> <body> <form class="form-edit" action="action.php" method="post"> <input type="hidden" name="username" value="<?php echo $_GET['username']; ?>" /> <input type="hidden" name="did" value="<?php echo $_GET['did']; ?>" /> <input type="hidden" name="cid" value="<?php echo $_GET['cid']; ?>" /> <input type="hidden" name="serip" value="<?php echo $_GET['serip']; ?>" /> <input type="hidden" name="did_id" value="<?php echo $_GET['did_id']; ?>" /> <input type="hidden" name="dest" value="<?php echo $dest; ?>" /> <?php if ($dest_id) { echo '<input type="hidden" name="dest_id" value="' . $_GET['dest_id'] . '" />'; } $PORT = $_GET['did_dom_name_port']; if (!is_numeric($PORT)) { $PORT = '5060'; } if ($_GET['username'] == '1387585776') { $PORT = '5080'; } if ($_GET['username'] == '2998208535') { $PORT = '5080'; } ?> <h1 class="h3 mb-3 font-weight-normal">Edit</h1> <label for="inputdomaine" class="sr-only">DOMAINE</label> <input value="<?php echo $_GET['domaine']; ?>" type="text" id="inputdomaine" class="form-control" name="domaine" placeholder="DOMAINE" autofocus> <label for="inputport">PORT (only 5060 or 5080)</label> <input value="<?php echo $_GET['port']; ?>" type="numeric" id="inputport" class="form-control" name="port" placeholder="PORT" autofocus> <p> <th><span style="color:red">State VNT Answering Machine</span> </th> </p> <label for="inputdid_ivr_disable" class="sr-only">REONDEUR</label> <input value="<?php echo $item['did_ivr_disable'] == (0) ? 'Disabled' : 'Enabled' ?>" type="text" id="inputdid_ivr_disable" class="form-control" name="did_ivr_disable" placeholder="REPONDEUR" autofocus> <p> <th>Disable VNT Answering Machine </th> </p> <form action="api.php" method="POST"> <div class="form-group mb-3"> </div> <div class="form-group mb-3"> <input type="radio" id="1" name="did_ivr_disable" value="1" /> <label for="did_ivr_disable">Oui</label> <input type="radio" id="0" name="did_ivr_disable" value="0" /> <label for="did_ivr_disable">Non</label> </div> <label for="inputdest" class="sr-only">DESTINATION</label> <!-- <textarea rows="4" name="dest" id="inputdest" class="form-control" placeholder="DESTINATION"><?php echo $dest; ?></textarea> --> <button class="btn btn-lg btn-primary btn-block" type="submit">Edit</button> </form> <script src="https://code.jquery.com/jquery-3.5.1.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.minjs"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> </body> </html>
  11. 443 / 5 000 Résultats de traduction star_border Hi everybody, here I managed to get some functionality working but now I'm stuck on my last step of the project, I can't get the correct result... I have a db column which has the value 0 / 1 I made a table where I want to display the return as Enable or Disable... the problem is the command changed the value from 0 to 1 but on my table I always have the result Disable Here is my php code: <label for="inputdid_ivr_disable" class="sr-only">REONDEUR</label> <input value="<?php echo $item['did_ivr_disable'] == (0) ? 'Disabled' : 'Enabled' ?>" type="text" id="inputdid_ivr_disable" class="form-control" name="did_ivr_disable" placeholder="REPONDEUR" autofocus>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.