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

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 a php code for a form but I don't know how to use it I started reading about php but still don't understand it. So when I use the code on the hosting my nav says the form is already sent so i had to stop using it. What should i do to receive e-mails from my form on my website. The fact is I even don't know if i put the code on the right place. Thank you very much!!!!! My website is http://www.victorpan.com/ I also attach the file with the code I want to use as a coment inside the code.contacto.php
  2. Question 24: The if statement is used to execute some code only if a specified condition is true Says the right answer is True. Not correct, you can also do if statements to check if something is not true with ! mark.
  3. Hello. I am currently editing my register.php file, which creates the user's account, but also at the same time makes a new file - their profile page. Here is the function: // Create profile page. $handle = fopen($username.".php", 'w'); $pageContent = ""; function createProfile() { fwrite($handle, $pageContent); } createProfile(); This function works, but not when I put this code inside -> https://pastebin.com/9j3rR12v. I have tried to swap all of the " for ' but it doesn't work. What happens is the register.php page does not load at all. It says there is an error. However, it loads the register.php page when I put: // Create profile page. $profileContents = include (profileContents.txt); $handle = fopen($username.".php", 'w'); $pageContent = "<!DOCTYPE html> <head><title>The title has changed.</title></head>"; function createProfile() { fwrite($handle, $profileContents); } createProfile(); When I then make an account, it creates the file, but the content doesn't go inside. A link to the code I would like to be displayed can be found here (compressed version): https://pastebin.com/9j3rR12v If you are able to help me out, it would mean the world. Many thanks. Emergency email: whunter@voltboxgaming.co.uk
  4. I have this little program: <!DOCTYPE html> <html> <body> <?php echo "why can not I explode array like 0->1, 1->2, 2->3 ..".'<br>'; ?> </body> </html> The output: why can not I explode array like 0->1, 1->2, 2->3 ..input script var total = [1,2,3,4,5];what I got with \ document.write(total) \ :1,2,3,4,5exploded array var_dump: array(1) { [0]=> string(40) "1,2,3,4,5" } so why does not explode the string in an array? This says it all!
  5. This is a weird request, been battling with the idea and the how, hoping for some help. I have a list of keys which need to sent out to each visitor who enters a site. the keys are currently on an Excel sheet, the keys must move sequentially down the list (Not repeat the above key) I thought of doing this with a form (like a gravity form) the problem is they dont allow you to read of the entries sequentially and show it on the screen that doesnt really work. happy to have the codes as an array, just the method of passing it out. if anyone knows of the code which can help me, i will be forever in your debt.
  6. I am able to retrieve data from a js like this: <!DOCTYPE html> <html> <body> <script> var a=[1,2,3,4] </script> <?php $ap= "<script> document.write(a) </script>"; print_r ($ap); $b=explode(',',$ap); print_r($b); ?> </body> </html> Result: 1,2,3,4Array ( [0] => 1,2,3,4 ) Why is the array not explode
  7. hello all, i stored the data in db in field page_desc. echo the field data works fine. <?php echo stripslashes($pageDetails["page_desc"]); but i want to change the color and font of each line of data which is retrieved from page_desc. how to do this..help me...
  8. I'm working on a Contact Form for my website. It works, except the "Phone" field doesn't show a phone number in the sent message. It's just blank where the number should be displayed. What am I doing wrong? - Thanks HTML: <div class="contact-form"> <h2 class="style">Contact Us</h2> <form action="contact.php" method="post" id="form"> <div> <span><label>NAME</label></span> <span><input name="cf_name" type="text" class="textbox"></span> </div> <div> <span><label>EMAIL</label></span> <span><input name="cf_email" type="text" class="textbox"></span> </div> <div> <span><label>PHONE</label></span> <span><input name="cf_phone" type="text" class="textbox"></span> </div> <div> <span><label>MESSAGE</label></span> <span><textarea name="cf_message"> </textarea></span> </div> <div> <span><input type="submit" value="Send"></span> </div> </form> </div> PHP: <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_phone = $_POST['cf_phone']; $field_message = $_POST['cf_message']; $mail_to = 'somebody@invalid.com'; $subject = 'Message from a website visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Phone: '.$field_phone."\n"; $body_message .= 'Message: '.$field_message; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); window.location = 'index.html'; </script> <?php
  9. hi , in the python requests POST tutorial in the site , there is this piece of code , url = 'https://ipaddress of my server .../myphp.php' myjson = {'somekey': 'somevalue'} x = requests.post(url, json = myjson) it sends the json data to a php file in a server that i have access to how can I access json data in myphp.php file in the server ??? thanks
  10. Tarun

    PHP

    i have created one php file and html file and connected to each other. But here i want a help reqards to php. Details mentioned below: This is my HTML file: <form method="post" action="contact.php"> <textarea name="message"></textarea> <input type="submit"> </form> This is my PHP file: <?php if($_POST["message"]) { mail("your@email.address", "Form to email message", $_POST["message"], "From: an@email.address"); } ?> Here i want to know is if i want to add another textarea say it as name in HTML, so can you help me with the PHP coding, as i have tried with adding the another text area in PHP to retrieve data to my email, but i am not able to receive that.
  11. Hello everyone, i have created a html form and a button. Javascript reacts to the button click sends the html values to functions.php and there i have a function to insert into the wordpress database. Every field is working and is being inserted into the database but i have some problems to upload and save a image file with these steps. Iam not using a html form i wanted to go the javascript way. Is there any option/solution to insert an image file as blob into mysql using php without form submit just via javascript ajax ? Thanks and best regards, Atilla
  12. Hello! I need to know how to create a sitemap, which updates automatically according to web posts. Our company website is https://www.albacars.ae/ , a used car dealer in UAE, we post cars everyday, and it should be updated automatically on sitemap. Instead of doing this manual, is there any way to do? Thank you!
  13. Hi I have a query that returns the count of entries based on CURDATE(), it works for any dat in this month (April) but does not work for next month (May). I think it is something to do with CURDATE()+3 returns 2018-04-31 which should be 2018-05-01 This Works as Date is in April SELECT COUNT(Machine) FROM production WHERE Status = 'Confirmed' AND DATE(FROM_UNIXTIME(production.Required)) = CURDATE() This does not work as in May SELECT COUNT(Machine) FROM production WHERE Status = 'Confirmed' AND DATE(FROM_UNIXTIME(production.Required)) = CURDATE()+3
  14. Hello All, I'm trying to create a table of images in which each image would be a different link to a product on our website. I'm just learning how to code so I appreciate any help you can give! Attached is pdf showing the general layout of what I'm trying to do. Thanks! Line Card 10-16-18.pdf
  15. I want to develop a library system in which fine will be calculated as follows- the code should be in php and sql database. I want to retrieve date from database and subtract it from current date. The difference will be then multiplied with 5 to know the fine. How can I do this? How can i retrieve date from database and subtract it from current date? returndate is column name from where i want to retrieve date for id=1 and issret is the table name. <form id="form1" name="form1" method="post" action=""><label for="txtDueDate"></label><input type="text" name="DueDate" id="txtDueDate" /><input type="submit" name="submit" id="submit" value="Submit" /></form><?phpif(isset($_POST['submit'])){$result=mysql_query("select returndate from issret where id=1"); if(mysql_num_rows($result)>0){$x=date("Y/m/d");$diff=date_diff($result,$x);echo $diff->format("%R%a days");}}?>
  16. iwato

    Undefined Variable

    GREETING: Happy New Year, W3Schools! I am looking forward to another year of online progress. Hopefully many of the problems that I have been experiencing for the last year and a half will disappear with the addition of a brand new iMac that can handle the latest PHP and MySql software. This said, I remain the advanced novice that I am and very much hope that you will continue to stand by my side. BACKGROUND: Please find below a set of code that permits one new set of functionality, but destroys another. The related error messages are provided beneath the code. if (isset($_GET['refer_type']) && filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) { $refer_type = $_GET['refer_type']; } else { $refer_type = 0; } if (isset($_GET['panel_type']) && filter_var($_GET['panel_type'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { $panel_type = $_GET['panel_type']; if (isset($_GET['lang_type']) && filter_var($_GET['lang_type'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { $lang_type = $_GET['lang_type']; } } else { $panel_type = 0; } ERROR MESSAGES: [05-Jan-2020 04:10:40 UTC] PHP Notice: Undefined variable: lang_type in /home/thege0/public_html/grammarcaptive.com/devcptv18rs/overview.html on line 99 QUESTION: Can you see anything in the code line if (isset($_GET['lang_type']) && filter_var($_GET['lang_type'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)) { $lang_type = $_GET['lang_type']; } or elsewhere that could be triggering the error. The code line just given is new and is clearly the initial, but maybe not the final source of the problem. By the way, when the code was first introduced, it did not appear to create a problem. Only several days later did the problem appear. Roddy
  17. Dear all, In my project, I am using an emebedded webserver LIGHTTPD with PHP. Within the main webpage, I use slider to write its value within a local file on my Linux OS. I wrote the slider like this: <input type="range" name="lightInputName" id="lightInputId" value="1" min="1" max="20" onchange="getvalor(this.value);" oninput="lightOutputId.value = lightInputId.value"> <input size="1" type="text" name="lightOutputName" id="lightOutputId"></input> What I want to do is to know if a javascript and/or PHP script is able to read the value of the slider, and copy it onto a local file. I don't have any idea on how to do this. Many thanks for your guidance. Best regards,
  18. Dear all, I am working on an embedded Linux platform with Lighttpd and PHP-7.0. My goal is using some HTML button and sliders to write some values on a local file. For example, if I click on a HTML button, I want to create and write a text file located in /home/$USER/ To do that, I build some files HTML <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>AI-VISION</title> <style> </style> </head> <body> <form action="test1.php" method="POST"> <input type="submit" value="Open Script"> </form> </body> </html> PHP <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); exec("/bin/bash /var/www/html/test.sh"); ?> SHELL BASH #!/bin/bash cd /home/$USER/ touch testFile && echo "This is a test" > testFile So, when I launch the Shell Script like this: cd /var/www/html ./test.sh It works fine, and when I launch the PHP script like this: cd /var/www/html php test1.php It works also. My problem is when I want to launch it through the webpage...it doesn't works. I think because I have some wrong permissions, so I did this: sudo usermod -a -G www-data $USER sudo chgrp -R www-data /var/www/html sudo chmod -R g+w /var/www/html But no luck, I still doesn't work. Do you have an idea of the problem ? Thanks for your help and support. Regards,
  19. Hi all, Working with: Linux Debian Lighttpd Server PHP7.0 I want to launch some shell scripts pressing HTML buttons. All the files are placed in /var/www/html The rights are done by: sudo chown www-data:www-data /var/www/ So, I wrote a very simple code: HTML test code (index.html): <form action="openApp.php"> <input type="submit" value="Open Script"> </form> PHP test code (openApp.php): <?php exec('test.sh'); header('Location: http://localhost/index.html?success=true'); ?> But no luck, nothing is working. Note that the shell script just create an empty file like that: touch /home/$USER/testFile Also, my Lighttpd configuration file is like that: server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_fastcgi", "mod_redirect", ) May be I am wrong with that piece of code. Do I need some Javascript to do the job ? May be the rights are wrong ? Could you help me please ? I am stuck with that. Thank you for your help and support
  20. Hi everyone. Anyone noticed that htmlentities() aren't working in php? Nor are htmlspecialcharacters. See: https://www.w3schools.com/php/phptryit.asp?filename=tryphp_func_string_htmlentities Any ideas?? I have also written a quick and dirty test routine which I have run on my server: <?php if(isset($_POST['char'])) { $char = $_POST['char']; $char2 = htmlspecialchars($char); $char3 = htmlentities($char); echo 'Teclado: ' . $char . '<br /><br />'; echo 'Repuesta 1: ' . $char2 . '<br /><br />'; echo 'Repuesta 2: ' . $char3; } echo '<form action = "char_test.php" method = "post"> <input type = "text" name = "char" size = "6"> <input type = "submit" name = "submit" value = "Search!" /> </form>'; It runs but doesn't return any ASCII entities. HELP!! Max
  21. Please someone give details about what is difference between get and post in php?
  22. 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
  23. 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
  24. I followed the following tutorial and I was finally able to add a slide in menu on my WordPress site. However, I noticed that the body scrolls when moving up and down on my mobile phone. Can someone explain to me how I can disable body scroll when the menu is opened? Many thanks in advance! Tutorial: https://www.w3schools.com/howto/howto_js_sidenav.asp <script> function openNav() { document.getElementById("mySidenav").style.width = "100%"; } function closeNav() { document.getElementById("mySidenav").style.width = "0"; } </script>
×
×
  • Create New...