Jump to content

Search the Community

Showing results for tags 'php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

  1. i have this school assignment and i really want to make a forum page but i dont know how to make it functional. pls help me.
  2. i rephrase yours answer as look at the pagination code there is 3 pages and 2 pages and 10 pages total means when no search condition is given it created 10 pages but problem is when ist condition is true and in result bottom of 3 pages is created and when i click one of my page data is refresh but in bottom pagination is gone to 10 while it should restrict to similarity when 2nd condition is true 2 pages is created and when i click one of two pages , data is refresh correctly but but in bottom the pagination is gone to 10......my question is how i can restrict the pagination along with the data if(!empty($searchData) || !empty($searchName)) case "search_data":{ //code here //code for pagination for example 3 pages is created in this condition } break; case "search_name": { //code here //code for pagination for example 2 pages is created in this condition } break; } else { //code here //code for pagination for example 10 pages is created in this condition } } <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> <button type="submit value="search_data">Search Data</button> <button type="submit value="search_name">Search Name</button> </form>
  3. Good day, I have a contact form that i pasted on this box, i have also attached the php and java script files that work with it. When i send a message via the contact form it does not send at all. it used to send successfully but it stopped. not sure where to look now. please advise what could be the problem. <div class="contact-details"> <!-- Contact Form --> <div class="contact-form wow bounceInRight"> <!--NOTE: Update your email Id in "contact_me.php" file in order to receive emails from your contact form--> <form name="sentMessage" id="contactForm" novalidate> <div class="col-md-6"> <input type="text" class="form-control" placeholder="Full Name" id="name" required data-validation-required-message="Please enter your name" /> <p class="help-block"></p> </div> <div class="col-md-6"> <input type="email" class="form-control" placeholder="email" id="email" required data-validation-required-message="Please enter your email" /> </div> <div class="col-md-12"> <textarea rows="10" cols="100" class="form-control" placeholder="Message (eg: message )" id="message" required data-validation-required-message="Please enter your message" minlength="5" data-validation-minlength-message="Min 5 characters" maxlength="999" style="resize:none"></textarea> </div> <div class="col-md-4 col-md-offset-5"><br><div id="success"> </div><button type="submit" class="btn btn-primary">Submit Message</button></div> </form> </div> </div> </div> </div> contact_me.js jqBootstrapValidation.js contact_me.php
  4. I'm attempting to pass a text string from a javascript process to a php process, using XMLHttprequest, and am getting an 'undefined array key' error. The php process should save the string to a file. It appears to pass the string to the php code okay as it returns the message 'File saved', but it also gives the error message 'undefined array key' on 'data' on line 2 of the php code. I appears to be saving a blank string to the text file as it overwrites any previous saved text in the file. So it looks like no data is being passed to the php codebut it is still try to save it. I'm no sure whether the problem is on the javascript side or the php side. The attached files are test code which reproduces the error. Clicking on the button in 'TestProgram.php will attempt to pass the test string to 'saveGame.php which should save the text string to 'test26.txt :- Any help would be much appreciated. TestProgram.php saveGame.php test26.txt
  5. Hello, can anyone please suggest what change should I make in order to make login using email/username either in same field or 2 different fields. <?php // Initialize the session session_start(); // Check if the user is already logged in, if yes then redirect him to welcome page if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){ header("location: welcome.php"); exit; } // Include config file require_once "c.php"; // Define variables and initialize with empty values $username = $password = ""; $username_err = $password_err = $login_err = ""; // Processing form data when form is submitted if($_SERVER["REQUEST_METHOD"] == "POST"){ // Check if username is empty if(empty(trim($_POST["username"]))){ $username_err = "Please enter username."; } else{ $username = trim($_POST["username"]); } // Check if password is empty if(empty(trim($_POST["password"]))){ $password_err = "Please enter your password."; } else{ $password = trim($_POST["password"]); } // Validate credentials if(empty($username_err) && empty($password_err)){ // Prepare a select statement $sql = "SELECT id, username, password FROM users WHERE (username = ? OR email= ?)"; if($stmt = mysqli_prepare($link, $sql)){ // Bind variables to the prepared statement as parameters mysqli_stmt_bind_param($stmt, "s", $param_username); // Set parameters $param_username = $username; // Attempt to execute the prepared statement if(mysqli_stmt_execute($stmt)){ // Store result mysqli_stmt_store_result($stmt); // Check if username exists, if yes then verify password if(mysqli_stmt_num_rows($stmt) == 1){ // Bind result variables mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password); if(mysqli_stmt_fetch($stmt)){ if(password_verify($password, $hashed_password)){ // Password is correct, so start a new session session_start(); // Store data in session variables $_SESSION["loggedin"] = true; $_SESSION["id"] = $id; $_SESSION["username"] = $username; // Redirect user to welcome page header("location: welcome.php"); } else{ // Password is not valid, display a generic error message $login_err = "Invalid username or password."; } } } else{ // Username doesn't exist, display a generic error message $login_err = "Invalid username or password."; } } else{ echo "Oops! Something went wrong. Please try again later."; } // Close statement mysqli_stmt_close($stmt); } } // Close connection mysqli_close($link); } ?> also, here is my error code- <?php // Initialize the session session_start(); // Check if the user is already logged in, if yes then redirect him to welcome page if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){ header("location: welcome.php"); exit; } // Include config file require_once "c.php"; // Define variables and initialize with empty values $username = $password = ""; $username_err = $password_err = $login_err = ""; $email = $password = ""; $email_err = $password_err = $login_err = ""; // Processing form data when form is submitted if($_SERVER["REQUEST_METHOD"] == "POST"){ // Check if username is empty if(empty(trim($_POST["username"]))){ $username_err = "Please enter username."; } else{ $username = trim($_POST["username"]); } // Check if mail is empty if(empty(trim($_POST["email"]))){ $email_err = "Please enter mail"; } else{ $email = trim($_POST["email"]); } // Check if password is empty if(empty(trim($_POST["password"]))){ $password_err = "Please enter your password."; } else{ $password = trim($_POST["password"]); } // Validate credentials if(empty($username_err) && empty($email_err) && empty($password_err)){ // Prepare a select statement $sql = "SELECT id, username, email, password FROM users WHERE (username = ? OR email= ?)"; if($stmt = mysqli_prepare($link, $sql)){ // Bind variables to the prepared statement as parameters mysqli_stmt_bind_param($stmt, "s", $param_username); // Set parameters $param_username = $username; // Attempt to execute the prepared statement if(mysqli_stmt_execute($stmt)){ // Store result mysqli_stmt_store_result($stmt); // Check if username exists, if yes then verify password if(mysqli_stmt_num_rows($stmt) == 1){ // Bind result variables mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password); if(mysqli_stmt_fetch($stmt)){ if(password_verify($password, $hashed_password)){ // Password is correct, so start a new session session_start(); // Store data in session variables $_SESSION["loggedin"] = true; $_SESSION["id"] = $id; $_SESSION["username"] = $username; // Redirect user to welcome page header("location: welcome.php"); } else{ // Password is not valid, display a generic error message $login_err = "Invalid username or password."; } } } else{ // Username doesn't exist, display a generic error message $login_err = "Invalid username or password."; } } else{ echo "Oops! Something went wrong. Please try again later."; } // Close statement mysqli_stmt_close($stmt); } } // Close connection mysqli_close($link); } ?> Please check it!
  6. paudom19

    NEED HELP AT TEST

    <html lang="en"> <head> <!-- SEO --> <meta content="Test, PHP, JS" name="keywords" /> <meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" name="viewport"> <meta content="ie=edge" http-equiv="X-UA-Compatible"> <meta content="DHIF19 Test" name="description"> <meta charset="UTF-8" /> <!-- Fonts --> <link href="https://fonts.gstatic.com" rel="preconnect"> <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet"> <!-- Bootstrap --> <link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" rel="stylesheet"> <script crossorigin="anonymous" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"></script> <style> * { font-family: Montserrat, sans-serif; margin: 5px; } </style> <title>DHIF19 | Beispiel 2</title> </head> <body> <?php // 1. Erste Abarbeitung (Assoziatives Array Ausgabe) print_r($_POST); // 2. Zweite Abarbeitung (Berechnen einer Potenz) // Button btn1 ist der "Schreibe-Button" // Ich mache hier Number 1 und Number 2 global, ist leichter fuer mich $num1 = $_POST['num1']; $num2 = $_POST['num2']; if (isset($_POST["btn1"])) { $result = pow($num1, $num2); echo "<br>" . "Die Potenz ergibt folgendes Ergebnis: " . $result; } if (isset($_POST["btn2"])) { $file = fopen("daten.txt", "a+"); fputs($file, $num1); fputs($file, " und "); fputs($file, $num2); fputs($file, " wurden eingelesen!"); fputs($file, "\n"); fclose($file); echo "<p>Im iFrame spiegeln sich die Daten ab, die eingegeben wurden: </p>"; echo "<iframe src='daten.txt' name='show' frameborder='0' style='width: 25%; height: 25vh;'></iframe>"; echo "<br>" . "<a href='table.php'>Hier zur Table Datei</a>"; } // Hier machen wir eine random Number zwischen 1 und 20 einfach so :) // KW Logik - Wenn man Button 3 drueckt, dann muss bei Action ja table.php stehen, ums zum funzen zu bringen ;) $randomnumber = rand(1, 20); if (isset($_POST["btn3"])) { print_r($_POST); echo "<br>"; echo "<br>"; if (empty($_POST["num1"]) || empty($_POST["num2"])) { echo "<p style='text-align:center;'><strong>[-]</strong> Vergessen, Werte einzutragen!</p>"; } else { echo "<div class='container'>"; echo "<table class='table table-striped table-hover'>"; echo "<thead>"; echo "<tr>"; for ($i = 0; $i < $_POST["num1"]; $i++) { echo "<th style='text-align: center;' scope='col'>(-‿-)</th>"; } echo "</tr>"; echo "</thead>"; echo "<tbody>"; for ($i = 0; $i < $_POST["num2"]; $i++) { echo "<tr>"; for ($j = 1; $j < $_POST["num1"] + 1; $j++) { echo "<td style='text-align: center;'>", $randomnumber, "</td>"; } echo "</tr>"; } echo "</tbody>"; echo "</table>"; echo "</div>"; } } ?> </body> </html> <!DOCTYPE html> <html lang="en"> <head> <!-- SEO --> <meta content="Test, PHP, JS" name="keywords" /> <meta content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" name="viewport"> <meta content="ie=edge" http-equiv="X-UA-Compatible"> <meta content="DHIF19 Test" name="description"> <meta charset="UTF-8" /> <!-- Fonts --> <link href="https://fonts.gstatic.com" rel="preconnect"> <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet"> <!-- Bootstrap --> <link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" rel="stylesheet"> <script crossorigin="anonymous" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"></script> <style> * { font-family: Montserrat, sans-serif; } #filename { width: 40%; } #num1, #num2 { width: 15%; } button { margin-top: 1.5em; } </style> <!-- JS --> <script> const makealert = () => { alert("Mashallah, hier ist ein Alert mit Pfeilfunktion, das kann der KW nicht hahah") } </script> <title>DHIF19 | Beispiel 1</title> </head> <body> <!-- Simple HTML Datei ohne besondere Angaben --> <div class="container"> <h3 style="margin-bottom: 1.3em; margin-top: 1.3em;">Formular</h3> <form action="welcome.php" method="POST"> <div class="form-group"> <label for="filename">Dateiname</label> <input type="text" class="form-control" name="file" placeholder="Dateiname" id="filename"> </div> <div class="form-group"> <label for="num1">Zahl <strong>a</strong></label> <input type="number" class="form-control" name="num1" placeholder="Gib eine Zahl ein" id="num1"> </div> <div class="form-group"> <label for="num2">Zahl <strong>b</strong></label> <input type="number" class="form-control" name="num2" placeholder="Gib eine Zahl ein" id="num2"> </div> <button type="submit" name="btn1" class="btn btn-primary">Schreibe</button> <button type="submit" name="btn2" class="btn btn-primary">Inhalt</button> <br> <button type="submit" name="btn3" class="btn btn-primary">Tabelle</button> <button name="btn4" onclick="makealert()" class="btn btn-primary">JS Button</button> </form> </div> </body> </html> <!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> </head> <body class="container" style="background: <?php if (isset($_POST["hintergrund"])) echo $_POST["hintergrund"] ?>"> <h2>Coole PHP Übung</h2> <p>Hintergrundfarbe wird geändert</p> <form action="<?php echo $_SERVER["SCRIPT_NAME"]; ?>" method="POST"> <div class="form-group"> <label for="name">Name:</label> <input type="text" class="form-control" placeholder="Name" name="name" id="name"> </div> <div class="container"> <label for="quantity">Wert:</label> <input type="number" id="wert" name="wert" min="1" max="20"> <input type="submit"> <p>Hintergrundfarbe</p> <div class="form-check"> <label class="form-check-label" for="radio1"> <input type="radio" class="form-check-input" id="radio1" name="hintergrund" value="#FF1234" checked>Rot </label> </div> <div class="form-check"> <label class="form-check-label" for="radio2"> <input type="radio" class="form-check-input" id="radio2" name="hintergrund" value="#FFFF00">Gelb </label> </div> <div class="form-check"> <label class="form-check-label" for="radio3"> <input type="radio" class="form-check-input" id="radio3" name="hintergrund" value="#8FEC95">Grün </label> </div> <div class="form-check"> <label class="form-check-label" for="radio4"> <input type="radio" class="form-check-input" id="radio4" name="hintergrund" value="#FFA000">Orange </label> </div> <button type="submit" class="btn btn-primary" name="absenden">Submit</button> </form> </div> <?php print_r($_POST); // define variables and set to empty values $name = $email = $gender = $comment = $website = ""; if (isset($_POST["absenden"]) && isset($_POST["hintergrund"])) { echo "<p><em>Neuer Hintergrund</em></p>"; } // $name = $_POST["name"]; // $wert = $_POST["wert"]; echo "<br><a>Name: </a>"; if (isset($_POST["name"])) { $name = $_POST["name"]; echo " $name <br>"; $fptr = fopen("cooleAusgabe.txt", "a+"); fputs($fptr, $name . "\n"); fclose($fptr); } echo "<br><a>Wert: </a>"; if (isset($_POST["wert"])) { $wert = $_POST["wert"]; echo " $wert <br>"; $fptr = fopen("cooleAusgabe.txt", "a+"); fputs($fptr, $wert . "\n"); fclose($fptr); } echo "Eingabe: " . $name . " Wert: " . $wert; echo "<br><br><br><a>Alle Eingaben: </a><br>"; $filepointer = fopen("cooleAusgabe.txt", "r"); while (!feof($filepointer)) { $zeile = fgets($filepointer); printf("%s", $zeile); } fclose($filepointer); ?> </body> </html> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link href="https://fonts.gstatic.com" rel="preconnect"> <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap" rel="stylesheet"> <!-- Bootstrap --> <link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" rel="stylesheet"> <script crossorigin="anonymous" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js"></script> <title>Fontsize-Changer</title> <style> * { font-family: Montserrat, sans-serif; } #exampleFormControlTextarea1 { width: 30%; } </style> </head> <body> <h2 style='text-align: center; margin: 1.5em;'> <strong> Change Fontsize </strong> </h2> <div class="container"> <form action="<?php echo $_SERVER["SCRIPT_NAME"]; ?>" method="POST"> <div class="container"> <p></p> <div class="form-group"> <label for="exampleFormControlTextarea1">Change Fontsize</label> <textarea class="form-control" id="exampleFormControlTextarea1" rows="1" name="size"></textarea> <small>You can write all possible ways to change a font-size</small> </div> <br> <button type="submit" class="btn btn-primary" name="submit">Submit</button> </div> </form> </div> <p style=" font-size: <?php if (isset($_POST["size"])) echo $_POST["size"] ?>; text-align: center;"><mark style="background: cyan"> ... Change me ...</mark></p> </body> </html>
  7. Hi everyone, I'm trying to create to select the name of table, then pick column in PHP, I succeed pick table, then put name table in variable, then put this variable to end of SQL syntax, then pick column name, then submit, but it went error by broke and violate of SQL syntax. Hey, It's not about SQL injection, this database is very useless. it's just practice. Can you help why it won't work? [php] $sqltable = "SHOW TABLES"; $querytable = $GaryDB->query($sqltable); while($row3 = $querytable->fetch()) { $table .= "<option value='$row3[0]'>" . $row3[0] . "</option>"; } if(isset($_POST['table'])) { $table2 = $_POST['table']; $sql = "SHOW COLUMNS FROM $table2 WHERE Field NOT IN ('id')"; $query = $GaryDB->query($sql); while ($row = $query->fetch()) { $list .= "<option value='$row[0]'>" . $row[0] . "</option>"; } } if(isset ($_POST['col'])){ $col = $_POST['col']; $selsql = "SELECT $col FROM $table2"; $colquery = $GaryDB->query($selsql); while ($row2 = $colquery->fetch()) { $list2 .= "<tr><td>" . $row2[0] . "</td></tr>"; } } else { $list2 = "No column on table"; } ?> <html> <head> <title>Gary Taylor's demonstration PHP Page</title> </head> <body> <p>Welcome to Gary Taylor's demonstration in PHP page.</p> <br /> <form action="demonstration.php" method="post"> <table> <tr><td><?php echo $selsql ?></td></tr> <tr><td>Please select table: <select name="table"> <?php echo $table ?> </select></td><td><input type="submit" name="submit2" value="selected"></td></tr> </table> </form> <form action="demonstration.php" method="post"> <table> <tr><td colspan="2">Sample of SELECT in column's name in table.</td></tr> <tr><td>SELECT <select name="col"> <?php echo $list ?> </select> FROM <?php echo $table2 ?></td><td><input type="submit" name="submit" value="selected"></td></tr> </table> </form> <table> <?php echo $list2 ?> </table> </body> </html> [/php] Thank you in advance times.
  8. 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></tr> Thank you for help
  9. Hello, please could you help me with this PHP script? It should recognize users web browser and according it should input correct condition. I make this because SAFARI and IE don't support function ' type:''date'' '. So can you give me an advice? CODE: <?php function detect() { if (\strpos($_SERVER['HTTP_USER_AGENT'], "MSIE", "Safari") === false){ echo 'Dátum zákroku / Date of procedure [YYYY-MM-DD]'; echo '<p><input class="w3-input w3-border" required name="datum_zakroku"></p>'; }else{ '<div class="w3-text-d1"><p><b>Dátum zákroku / Date of procedure</b></p></div> <p><input class="w3-input w3-border" type="date" required name="datum_zakroku"></p>'; } } detect(); ?>
  10. Hello, please could you help me with my problem about PHP script? I need my program to detect user browser because html function 'type=''date'' ' is not supported by SAFARI and IE. Please help me with this. Thanks <?php function detect() { /*$info = $_SERVER['HTTP_USER_AGENT'];*/ /* @var $_SERVER type */ echo $_SERVER['HTTP_USER_AGENT']; $browser = get_browser(); print_r($browser); if (\strpos($browser, 'IE') === true){ echo 'Dátum zákroku / Date of procedure [YYYY-MM-DD]'; echo '<p><input class="w3-input w3-border" required name="datum_zakroku"></p>';} else if (\strpos($browser, 'Safari') === true){ echo 'Dátum zákroku / Date of procedure [YYYY-MM-DD]'; echo '<p><input class="w3-input w3-border" required name="datum_zakroku"></p>';} else{ '<div class="w3-text-d1"><p><b>Dátum zákroku / Date of procedure</b></p></div> <p><input class="w3-input w3-border" type="date" required name="datum_zakroku"></p>';} } detect() ?>
  11. I want to know how I would go about making a script where a user would type in a message and post that said message. Is sql required?
  12. Hi All, I've seen that in PHP you can include a require or include function which saves you from having to add the entire code for headers and footers for each page. Does a similar things exist in HTML? If so, please direct me. Thanks in advance Russell
  13. I have used the W3 template to produce a script that uploads image changes to a directory on my server, updates the URL in my database and logs the event. Works beautifully IF the source folder is: \Pictures or \Pictures\Personal But fails if it is any other source folder, even the peer folder \Pictures\BarImages Why?
  14. In the lesson on PHP Filters in the code sample "Validate an Integer" there is the following code: <?php $int = 100; if (!filter_var($int, FILTER_VALIDATE_INT) === false) { echo("Integer is valid"); } else { echo("Integer is not valid"); } ?> Why use this expression: (!filter_var($int, FILTER_VALIDATE_INT) === false) instead of what seems to me to be the more logical expression?: (filter_var($int, FILTER_VALIDATE_INT) === true) Thanks.
  15. https://www.w3schools.com/php/phptryit.asp?filename=tryphp_filter_adv3 is a tutorial example. It attempts to validate what appears to be a valid URL but claims it is not. I see this forum gets little use, so has the language changed since the example was created, is there a mistake in the example, or is the problem on my end in the browser? I am using the latest FireFox browser under Windows 10.
  16. In PHP 5, I conventionally opened my pages with <?php but within the pages I often used <? to open a php block, e.g., <?echo $variable; ?>. In PHP 7, I find it is necessary to always use <?php and follow it with a space, e.g., <?php echo $variable; ?> I haven't been able to find any reference to this syntax change so my question: Is this a new requirement of PHP 7? Can it be turned off? Otherwise, I will need to edit all of the sites where my earlier habit was used, which I think I can do but would feel compelled to spend some hours testing afterward.
  17. Qazi

    Toggle Switch

    Hello everyone I am doing an IOT project in which is am successfull to send my microcontroller data to MySQL. I am receiving data in 0 and 1. Now what i want to do? I just to create a toggle switch that will ON when data in database is 1 and when data is 0 it remains OFF. secondly when i click the switch it should OFF in case it is already ON and a data 0 should be sended to database. same in case of OFF to ON. Please help me You can also use Javascript.
  18. I have changed the code, because it happens to me before with another code. The thing is my code is aparently ok but when you fill the form and send it the e-mail is not sent. Any idea, please? Thank you. I Attach the code and the html page. My web site is http://victorpan.com/contacto.html contacto.php correo.php
  19. Hello everyone I want Show Some Recorded according financial year For Example from 01-04-2016 to 31-3-2017 01-04-2017 to 31-03-2018 my Code $pst = date('Y'); $pt = date('Y', strtotime('+1 year')); $sql="SELECT *FROM mytable where date BETWEEN CAST('$pst-04-01' AS DATE) AND CAST('$pt-03-31' AS DATE)"; Anyone Can explain how i done this
  20. At Ingolme's suggestion, I've switched from simpleXML to DOMXML for this because I need to be able to replace a node. I've done my best to follow PHP.com examples, and everything seems to work up until the point of the actual replacement. I hope you can spot what's keeping it from working. The vars found in the heredoc are assigned earlier from the customer input form. if $found is positive, it contains a cId (customer ID) that exists in the DB and should be updated with any new info (code shown). If negative, it's abs() is the cId for a new node to be added (code omitted here). In $xml, the <customer> node is child of <customers>, which is child of <root>. If I comment out the replaceChild line before the break, execution continues unhindered. Nodename reports "customer" and nodetype reports 'XML_ELEMENT_NODE' for both $node and $oldNode, so I don't know what is preventing the replacement. // SAVE CUSTOMER DATA // $found= $cId; $cId = abs($found); // Create DOM from data file $xml = new DOMDocument; $xml->formatOutput = true; $xml->load("Titles data.xml"); // Create node from customer input $str = <<<XX <customer> <cId>$cId</cId> <organization>$organization</organization> <website>$URL</website> <contact>$name</contact> <email>$email</email> <phone>$phone</phone> <addr>$address</addr> <city>$city</city> <state>$state</state> <zip>$zip</zip> <orders> <oId></oId> </orders> </customer> XX; $DOMChild = new DOMDocument; $DOMChild->loadXML($str); //turn $str into DOMDoc $node = $DOMChild->documentElement; //not sure if this is right, example suggests it is $node = $xml->importNode($node, true); //Is this necessary? examples suggest it is if ($found > 0) { //if positive, $found contains cId of desired customer $list = $xml->getElementsByTagName("cId"); //list of ID's to search for ($r = $list->length -1; $r > 0; $r--) { //find customer that fits cId if ($list->item($r)->nodeValue==$cId) { //when found, $r is index to customer node list $oldnode=$xml->getElementsByTagName("customer")->item($r);// get node to be replaced $msg=$r."—"; //$msg is included in email sent later; shows arrival here $node->replaceChild($node, $oldNode); //THIS LINE FAILS, HALTING EXECUTION break; } } }
  21. So I wants to take value from URL, I create simple PHP code for taking value from URL <?php if(isset($_POST["Search"])){ $url = $_POST["url"]; $value = (explode ('v=', $url)); $videoId = $value[1]; } ?> This for taking value from this https://www.youtube.com/watch?v=value url and echo somewhere, but wants to take value from https://www.youtu.be/value , this also, but how? , work with both URLs
  22. i'm trying to write some line for stock valuation with FIFO method. in the internet somewhere i found with STACK &/or QUEUE method it might be done. but i couldn't understand how it might be done. can anyone please suggest me if STACK &/or QUEUE are the real solution. if no suggest me something better and if yes help me understand these functions.. tahnks in advance.....
  23. Hi all, l'm a Newbie here I would like to create a page, which after user logged in, they was able to update number of chanting daily with number input. User may insert number and click submit button to update its. After updated, below the submit button, to show up the total number of their total chanting number, and total of all users chanting numbers. Lastly is the history of users update in table view which showing username, date of update, number of updates. Can I have the solution or any related article or site which i can referring to... Thanks all.
  24. I have a problem with an XML file that has the following structure: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DATAPACKET Version="2.0"> <METADATA><FIELDS> <FIELD attrname="Id" fieldtype="i4" readonly="true" SUBTYPE="Autoinc"/> <FIELD attrname="Blocco" fieldtype="string" WIDTH="5"/> <FIELD attrname="Domanda" fieldtype="string" WIDTH="2"/> <FIELD attrname="Risposta" fieldtype="boolean"/> <FIELD attrname="Capitolo" fieldtype="string" WIDTH="2"/> <FIELD attrname="Indice" fieldtype="string" WIDTH="3"/> <FIELD attrname="Argomento" fieldtype="string" WIDTH="1"/> <FIELD attrname="SubArgomento" fieldtype="string" WIDTH="2"/> <FIELD attrname="Figura" fieldtype="string" WIDTH="4"/> <FIELD attrname="FiguraBlk" fieldtype="string" WIDTH="4"/> <FIELD attrname="Difficolta" fieldtype="string" WIDTH="2"/> <FIELD attrname="Testo" fieldtype="string" WIDTH="320"/> <FIELD attrname="Lingua1" fieldtype="string" WIDTH="320"/> <FIELD attrname="Lingua2" fieldtype="string" WIDTH="320"/> <FIELD attrname="Lingua3" fieldtype="string" WIDTH="320"/> <FIELD attrname="Commento" fieldtype="string" WIDTH="256"/> <FIELD attrname="Aiuto" fieldtype="string" WIDTH="128"/> <FIELD attrname="Foto1" fieldtype="string" WIDTH="5"/> <FIELD attrname="Foto2" fieldtype="string" WIDTH="5"/> <FIELD attrname="Foto3" fieldtype="string" WIDTH="5"/> <FIELD attrname="Foto4" fieldtype="string" WIDTH="5"/> <FIELD attrname="Foto5" fieldtype="string" WIDTH="5"/> <FIELD attrname="Video1" fieldtype="string" WIDTH="5"/> <FIELD attrname="Edl1" fieldtype="string" WIDTH="15"/> <FIELD attrname="Video2" fieldtype="string" WIDTH="5"/> <FIELD attrname="Edl2" fieldtype="string" WIDTH="15"/> <FIELD attrname="Video3" fieldtype="string" WIDTH="5"/> <FIELD attrname="Edl3" fieldtype="string" WIDTH="15"/> <FIELD attrname="Audio1" fieldtype="string" WIDTH="12"/> <FIELD attrname="Audio2" fieldtype="string" WIDTH="12"/> <FIELD attrname="Audio3" fieldtype="string" WIDTH="12"/> <FIELD attrname="Html1" fieldtype="string" WIDTH="5"/> <FIELD attrname="Html2" fieldtype="string" WIDTH="5"/> <FIELD attrname="Html3" fieldtype="string" WIDTH="5"/><FIELD attrname="Libro1" fieldtype="string" WIDTH="5"/> <FIELD attrname="Libro1PosY" fieldtype="string" WIDTH="5"/> <FIELD attrname="Libro2" fieldtype="string" WIDTH="5"/> <FIELD attrname="Libro2PosY" fieldtype="string" WIDTH="5"/> <FIELD attrname="Libro3" fieldtype="string" WIDTH="5"/> <FIELD attrname="Libro3PosY" fieldtype="string" WIDTH="5"/> <FIELD attrname="Info1" fieldtype="string" WIDTH="120"/> <FIELD attrname="Info2" fieldtype="string" WIDTH="120"/> <FIELD attrname="Gruppo1" fieldtype="string" WIDTH="3"/> <FIELD attrname="Gruppo2" fieldtype="string" WIDTH="3"/> <FIELD attrname="Gruppo3" fieldtype="string" WIDTH="3"/> </FIELDS><PARAMS AUTOINCVALUE="7166"/></METADATA> <ROWDATA> <ROW Id="2" Blocco="11023" Domanda="02" Risposta="TRUE" Capitolo="01" Indice="A01" Argomento="A" SubArgomento="1" Figura="" FiguraBlk="" Difficolta="6" Testo="I ciclomotori possono avere due o tre ruote" Lingua1="Les motocycles légers peuvent avoir deux ou trois roues" Lingua2="Kleinkrafträder können zwei oder drei Räder haben" Lingua3="I ciclomotori possono avere due o tre ruote" Commento="infatti i CICLOMOTORI possono avere DUE, TRE e anche QUATTRO RUOTE, cilindrata fino a 50 cm³ e velocità fino a 45 km/h." Aiuto="Classificazione dei veicoli." Foto1="3113" Foto2="" Foto3="" Foto4="" Foto5="" Video1="" Video2="" Video3="" Audio1="04023_40231" Audio2="" Audio3="" Html1="" Html2="" Html3="" Libro1="1" Libro2="1" Libro3="" Info1="11023" Info2="Ciclomotori"/> <ROW Id="3" Blocco="11023" Domanda="03" Risposta="TRUE" Capitolo="01" Indice="A01" Argomento="A" SubArgomento="1" Figura="" FiguraBlk="" Difficolta="5" Testo="Non tutti i veicoli a motore a due ruote vengono classificati ciclomotori" Lingua1="Pas tous les véhicules à moteur à deux roues peuvent être classifiés des motocycles légers" Lingua2="Nicht alle zweirädrigen Kraftfahrzeuge werden als Kleinkrafträder eingestuft" Lingua3="Non tutti i veicoli a motore a due ruote vengono classificati ciclomotori" Commento="infatti vengono CLASSIFICATI CICLOMOTORI solo i veicoli a DUE RUOTE con CILINDRATA NON SUPERIORE a 50 cm³ e VELOCITÀ NON SUPERIORE a 45 km/h." Aiuto="Classificazione dei veicoli." Foto1="1238" Foto2="" Foto3="" Foto4="" Foto5="" Video1="" Video2="" Video3="" Audio1="04023_40232" Audio2="" Audio3="" Html1="" Html2="" Html3="" Libro1="1" Libro2="1" Libro3="" Info1="11023" Info2="Ciclomotori"/> it continues with this structure but it is very long. How can I do from my SQL DB to extract a data ("Libro3") to insert it inside every occurrence of ''Libro3' of XML file? In my sql to recognize the line to be modified I have Id,Blocco, Libro3 obviously, but i don t know how i can modify the file. to recognize the line to be modified on the sql I have line, id and block
  25. I have changed the code, because it happens to me before with another code. The thing is my code is aparently ok but when you fill the form and send it the e-mail is not sent. Any idea, please? Thank you. I Attach the code and the html page. My web site is http://victorpan.com/contacto.html contacto.html correo.php
×
×
  • Create New...