Jump to content

Sigmahokies

Members
  • Content Count

    65
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Sigmahokies

  • Rank
    Newbie

Recent Profile Visitors

3,696 profile views
  1. Never mind everyone, I found to make it work...I remove "action='[file]'" from HTML form. Thank you for effort
  2. 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.
  3. 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.
  4. 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></td></tr> <tr><td colspan='5'><input type='text' name='update1' value='".$change['FirstName']."'></td></tr> <tr><td colspan='5'><input type='text' name='update2' value='".$change['LastName']."'></td></tr> <tr><td colspan='5'><input type='text' name='update3' value='".$change['City']."'></td></tr> <tr><td colspan='5'><input type='text' name='update4' value='".$change['State']."'></td></tr> <tr><td><input type='radio' name='update5' value='EST'>EST</td><td><input type='radio' name='update5' value='CST'> CST</td><td><input type='radio' name='update5' value='MST'> MST</td><td><input type='radio' name='update5' value='PST'> PST</td></tr> <tr><td colspan='5'><input type='submit' name='updateddata' value='Update data'></td><tr>"; if(isset($_POST['updateddata'])) { $updateFirst = $_POST['update1']; $updateLast = $_POST['update2']; $updateCity = $_POST['update3']; $updateState = $_POST['update4']; $updateTime = $_POST['update5']; $updated = "UPDATE `sampleDB` SET `FirstName`='$updateFirst', `LastName`='$updateLast', `City`='$updateCity', `State`='$updateState', `TimeZone`='$updateTime' WHERE `ID` = '$edit';"; $up_date = mysqli_query($GaryDB, $update); if(isset($up_date)) { header('location: sampleDB.php'); } else { $updated2 = "Could not updated data"; } } } } Anyone can help will be very appreciate Thanks, Gary
  5. dsoneuk, You are right, it works now...thank you so much! Gary
  6. 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>".$row['FirstName']."</td><td>".$row['LastName']."</td><td>".$row['City']."</td><td>".$row['State']."</td><td>".$row['TimeZone']."</td></tr>"; } } else { $display = "<tr><td>None of record in database</td></tr>"; } mysqli_close($GaryDB); Can you help? Thanks, Gary
  7. 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>"; } elseif (empty($_POST['LastName'])) { $error = "<tr><td colspan='2'>Last Name is required</td></tr>"; } elseif (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $error = "<tr><td colspan='2'>Invalid e-mail format</td></tr>"; } else { $first = $_POST['FirstName']; $last = $_POST['LastName']; $email = $_POST['email']; $comment = $_POST['comment']; $title = $_POST['Title']; $emailGary = "XXXX@gmail.com"; if(mail($emailGary, $title, $comment)) { $sent = "<tr><td colspan='2'>E-mail has been sent</td></tr>"; } else { $sent = "<tr><td colspan='2'>E-mail has not sent</td></tr>"; } } } ?> <body class="background"> <h5><a href="#garydtaylor">XXXX</a></h5> <div class="w3-row"> <div class="w3-col" style="width:300px; text-align: left; padding-left: 50px;"><p>Hello</p></div> <div class="w3-rest w3-round" style="text-align: left; padding-left: 50px;"><p>Hello</p> <form action="resume.php" method="post"> <table cellpadding="5"> <tr><td>* First Name:</td><td><input type="text" name="FirstName"></td></tr> <tr><td>* Last Name:</td><td><input type="text" name="LastName"></td></tr> <tr><td>* Title:</td><td><input type="text" name="Title"></td></tr> <tr><td>* Email:</td><td><input type="text" name="email"></td></tr> <tr><td valign="top">* Comment:</td><td><textarea maxlength="5000" cols="18" rows="6" type="text" name="comment"></textarea></td></tr> <tr></tr><td></td><td><input type="submit" name="submit" class="w3-round" style="background: maroon; color: white; height: 25px; width: 175px;" value="E-mail to Gary Taylor"></td> <?php echo $error ?> <?php echo $sent ?> </table> </form> </div> </div> </div> </body> </html> Can you help me? Of course, i will use CSS to make it decoration as style, but I want to make sure it works. Thanks, Gary
  8. 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
  9. Sigh...All right, you are not helpful. I will do other forum, I hope someone can help me.
  10. 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.
  11. 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.
  12. So, do i have to use class? class is allowed to have multiply...
  13. 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> <script> function clickvideo() { let path = document.getElementById("video1").button; document.getElementById("display").innerHTML = "<video width='450' controls style='border-radius: 5px;' height='240' type='mp4'>" + "<source src='UPLOADS/Breakfast/" + path + "'></video>"; } </script> </head> <body> <table class="table"> <tr><td><video width="450" controls style="border-radius: 5px;"><source src="video/Ha_Demo.mp4"></video></td></tr> <tr><td> <div id='display'><video width='450' controls style='border-radius: 5px;'><source src="UPLOADS/Breakfast/hello.mp4"></video></div></td></tr> <tr><td> <?php $video = opendir("UPLOADS/Breakfast/"); while(($listvideo = readdir($video)) !== FALSE) { if(preg_match("/^[^\.].*$/", $listvideo)) { echo "<button id='video1' onclick='clickvideo()'>".$listvideo."</button>&nbsp;"; } } ?> </td></tr> </body> </html>
  14. So, do I have to find source, then download it, then put in path to connect to this script?
  15. 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 log show it is not function.
×
×
  • Create New...