Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Sigmahokies

  1. dsonesuk, i forget to add .=, it showed now. Thank you!
  2. Hi everyone, I'm trying to use PDO to insert data in database, seem none of them success, it just breakdown after I click button to submit. what did I do wrong? [php] <?php /* check to see connection is working */ if(isset($_POST['submit'])) { $server = "localhost"; $username = "Sigma"; $password = ""; $dbname = "Register"; try { $connect = new PDO ("mysql:host=$server;dbname=$dbname", $username, $password); } catch (PDOException $error){ echo $error->getMessage(); } /* Insert data into database */ $firsts =
  3. Hello everyone, I'm trying to get abbreviate states from plain text into HTML select and option, seem it's not working. Can you help me? here my PHP code: /* Read file to insert as option in HTML */ $file = fopen("States.txt","r") or exit("Unable to read"); while(!feof($file)) { $states = fgets($file); $statelist = "<option value='".$states."'>".$states."</option>"; } fclose($file); Then <tr><td>State:</td><td><select id="abb" name="abb"><?php echo $statelist ?></select></td>
  4. Never mind everyone, I found to make it work...I remove "action='[file]'" from HTML form. Thank you for effort
  5. Oh, I missed that part, I just changed that $updated from $update. Seem it doesn't work with update in database, it's result same. It haven't update...I think something is missing, I tried to use PHP tester, test showed it's fine. Very odd.
  6. No error is showing, all syntax are corrected. Only I see that data has not change when I entered the update a data in the database.
  7. Hi everyone, I need a help...I don't understand why it is not work. I'm trying to "update" data in database, but it couldn't do that. Maybe there is wrong script in PHP. Can you find what did I do wrong? //Edit data from database if(isset($_GET['edit'])) { $edit = $_GET['edit']; $update = "select * FROM sampleDB where ID = '$edit';"; $updated = mysqli_query($GaryDB, $update); $change = mysqli_fetch_assoc($updated); if($change) { $editted = "<tr><td colspan='4'><input type='text' name='update' value='".$change['ID']."' readonly>&l
  8. dsoneuk, You are right, it works now...thank you so much! Gary
  9. Hi everyone, I'm trying to display all record in php from database, there are three rows in phpmyadmin already, but why while won't print three rows? it just printed last row. what did I do wrong? I followed exactly from w3school's instruct, but it is still show last row, not all record. $show = "SELECT FirstName, LastName, City, State, TimeZone FROM sampleDB"; $query = mysqli_query($GaryDB, $show); if(mysqli_num_rows($query)) { while($row = mysqli_fetch_assoc($query)) { $display = "<tr><td>
  10. Sigmahokies

    PHP email

    Hi everyone, Can anyone help me underatdn why my email in php didn't work. I set up the email form in web, seem it didn't send at all. I put boolean with email, then I tested to fill out text to send email, then it said it didn't send email at all. What did I do wrong? <?php $error = ""; if($_SERVER['REQUEST_METHOD'] == "POST") { if (empty($_POST['email'])) { $error = "<tr><td colspan='2'>E-mail is required</td></tr>"; } elseif (empty($_POST['FirstName'])) { $error = "<tr><td colspan='2'>First Name is required</td></tr&
  11. Hi everyone, I'm wondering about Javascript and PHP allow to using same keyword with different reason, like using keyword word twice in html line. For example, I'm using keyword "name" in Javascript for count in adjust number, now, I'm trying to use keyword "name" for other reason, like undo all checked. Can use keywords more than one time? or cannot be done? Thanks, Sigmahokies
  12. Sigh...All right, you are not helpful. I will do other forum, I hope someone can help me.
  13. I'm still not get it...Maybe that "this" keyword is not useful. I'm not sure I understand, I thought "this" is good for pass variable to other class like other page.
  14. I'm not sure I get it about your last reply. I checked around about "this" keyword in Javascript...it's not clear to me.
  15. So, do i have to use class? class is allowed to have multiply...
  16. Hi everyone, I'm still learning, but getting deeper now. I'm trying to use JavaScript and PHP in one page in website. I'm trying to make a switch video source on html by click on button. I believe I'm doing right in PHP, but Javascript seem something is missing. I don't understand how it gone work...it said undefined. <!doctype html> <html> <head> <link href="css/grammar.css" rel="stylesheet" type="text/css"> <link rel="icon" href="images/sigma.png"> <script type="text/javascript" src="js/checkbox.js"></script>
  17. So, do I have to find source, then download it, then put in path to connect to this script?
  18. Hello everyone, I'm trying to create a RSA encryption, but seem it is not function correctly. Is Javascript know RSA? like, let rsa = new RSA(); do I have to download from github? here my code: let rsa = new RSA(); let prime = ["2", "3", "5", "7", "11", "13"] //<-- Prime number let random = prime[Math.floor(Math.random() * prime.length)]; let text = document.getElementById("readed"); document.getElementById("en").innerHTML = rsa.encrypt(random, text); Seem console
  19. Never mind, i found a way to post, Javascript and PHP can use one keyword, but work in separate.
  20. Hi Justsomeguy, Ok here my code, I replaced array ([ ]) to nothing in PHP, so PHP should able to get data from this name. <tr><td>Go/Walk-To/From</td> <td><label for="box"><input class="single-count" type="checkbox" id="box" name="chkboxGrp0[]" value="1"></label></td> <td class="vert-middle">0</td></tr> <tr><td>Bring-Stack-Comic</td> <td><input class="single-count" type="checkbox" name="chkboxGrp1[]" value="1"></td> <td class="vert-middle">0&
  21. Hi everyone, I want to make clear again. I am trying to get data from "name" by PHP in HTML, but problem is "name" is used up by Javascript, but I need "name" for PHP's $_POST to get data from input from html, but can I use this "name" by JavaScript and PHP in same time? I need to get data from that word to post in database, but I think I'm stuck now...Anyone can tell me what is alternative keyword to get data from "name" in HTML? If you don't understand what I said, I will display and show you Thanks, Gary
  22. Hi everyone, is it possible to collect data such as checkbox and radio inside iframe when push button outside of iframe? or require to method of post inside iframe?
  23. I used session storage, seem it doesn't work. I use localstorage, seem it works a little, but stayed checked on checkbox has not work. here code I get from other website, but seem function is not right <script> function onClickBox() { let checked = $("#box").is(":checked"); localStorage.setItem("checked", checked); $("#msg").text("Checkbox is checked: " + $("#box").is(":checked")); } function onReady() { $("#msg").text("Loaded."); let checked = "true" === localStorage.getItem("checked"); $("msg").prop('checked', chec
  24. Does that mean i have to use PHP as well?
  • Create New...