Search the Community
Showing results for tags 'php'.
-
Hi Guys I am currently working on a Laravel Page. Now there is a bad explanation on how it dosn't work. I am writing browser based test atm. Now I have "Buttens" on my website to add a product to the cart. because there are more then one product the "Buttons" are numbered using data-id. The "Buttons" also have a universal name "add-to-cart" Using chrome developing tool I am trying to find the code peace using keywords: This is the Code peace: <a href="javascript:void(0);" class="btn btn-icon btn-primary sa-add-to-cart" id="add-to-cart" data-id="1"> <svg class="lnr lnr-cart "> usexlink:href="/icons.svg#lnr-cart"></use></svg></a> "Hinzufügen" is the name of the "Button" as you can see, the data-id is 1 and the id is add-to-cart. I want to search for both at the same time. I have tried #add-to-cart:nth-child(1) but this shows all the #add-add-to-cart elements. How can I define a single element. Hope you can understand my very bad explanation of my problem. Thanks for your help Janick
-
How to choose a element from a formula in a dusk test
Janick.Spielmann posted a topic in Programming
I am working on a project for university here in Switzerland I have already tried reading the laravel dusk instruction (https://laravel.com/docs/5.8/dusk) and googled it. But I could not finde anything that works. so here is my problem. I have a filter with witch I can choose a type (Typ) and a manufacturer (Hersteller) from a list. and I tried ->type and then ->click a item but that dose not work ? How can I choose a item from the list? -
Hello. I'm relatively new at coding but I know my way around HTML and css. I'm trying to design a website that has a chatroom for us to talk with and I have absolutely no idea what I am doing. I searched the internet for so long to find a tutorial or something. Anyone have any help? I'm tired of deleting code over and over again.
-
Any replacement for header(location) ? in this code it split error instead of redirecting when i put the php after writing comment section, but when i put it before it, it does work, even just the comments section when i put it in different file all alone it does work normally. Would take any suggestion. WHOLE CODE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <link href="https://fonts.googleapis.com/css?family=Alegreya+Sans" rel="stylesheet"> <link rel="stylesheet" href="style.css" type="text/css"> <!-- #BeginTemplate "master.dwt" --> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <!-- #BeginEditable "doctitle" --> <title>VVT37.CZ</title> <style type="text/css"> .style2 { font-size: large; text-align: left; background-color: #FFFFFF; border-bottom-style: none; border-bottom-color: #000000; } .style15 { text-align: center; background-color: #F8E8D9; } .style18 { text-align: center; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: #333333; } .style20 { font-size: 4px; text-align: center; color: #723007; border-bottom-style: none; border-bottom-color: #000000; background-color: #FFFFFF; } .style21 { text-align: center; font-size: large; color: #4F3E2B; border-bottom-style: none; border-bottom-width: 1px; border-bottom-color: #333333; } .style24 { font-size: small; } .style25 { color: #000000; text-align: center; background-color: #FCCD9C; } .style26 { border-bottom: 2px solid #FABA6F; background-color: #FFFAF4; color: #000000; background-image: none; text-align: center; } .style28 { border-bottom: 1px none #333333; text-align: center; font-size: 12pt; color: #4F3E2B; background-color: #FFE1C1; } .style29 { text-align: center; background-color: #F8BF86; } .style30 { border-bottom: 1px solid #333333; text-align: left; background-color: #FFF5EA; } .style32 { border-bottom: 1px solid #333333; text-align: center; color: #D50404; background-color: #F8E8D9; } .style34 { color: #01016D; } .style35 { color: #000000; } .style36 { color: #F58D23; } .style37 { font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif; font-size: small; } .style38 { text-decoration: none; } .style39 { border-bottom: 1px solid #333333; text-align: left; background-color: #FFDCB9; } .style40 { background-color: #F8E8D9; } .style41 { background-color: #FFFAF4; } </style> <!-- #EndEditable --> <link href="styles/style1.css" media="screen" rel="stylesheet" title="CSS" type="text/css" /> <style type="text/css"> .style1 { font-size: xx-small; } .style2 { background-color: #FFFFFF; } .style3 { border-width: 0; } .style4 { font-size: small; } </style> </head> <body> <!-- Begin Container --> <div id="container"> <!-- Begin Masthead --> <div id="masthead"> <table cellpadding="0" cellspacing="0" style="width: 900px"> <tr> <td style="width: 299px; height: 107px; text-align: left;"> </td> <td style="width: 300px; height: 107px;"> </td> <td style="width: 300px; height: 107px; text-align: right;"> </td> </tr> </table> </div> <!-- End Masthead --> <!-- Begin Navigation --> <div id="navigation"> <ul> <li><a href="index.html">Úvod</a></li> <li><a href="stranky/partneri.htm">Partneři turnaje</a></li> <li><a href="stranky/realizacni%20tym.htm">Realizační tým</a></li> <li><a href="stranky/mapa.htm">Mapka</a></li> <li><a href="stranky/fotogalerie.htm">Fotogalerie</a></li> <li><a href="stranky/dokumenty.html">Dokumenty</a></li> <li><a href="seznamka.php">Seznamka</a></li> </ul> </td> </tr> <tr> <td class="style2"> <img alt="" height="130" src="images/A-vetkom-veter.nav.gif" width="140" style="padding-top:20px;" /></td> </tr> </table> </li> </ul> </div> <!-- End Navigation --> <!-- Begin Content --> <div id="content"> <!-- #BeginEditable "content" --> <table cellpadding="0" cellspacing="0" style="width: 100%"> <form action="" method="POST"> <label> Vaše Jméno <input type="text" name="Name" class="Input" style="width: 225px" required> </label> <label> e-mail: <input type="text" name="Mail" class="Input" style="width: 225px" required> </label> <label> Předmět: <input type="text" name="Predmet" class="Input" style="width: 225px" required> </label> <br><br> <label> Vaše Zpráva: <br> <textarea name="Comment" class="Input" style="width: 300px" required></textarea> </label> <br><br> <input type="submit" name="Submit" value="Submit Comment" class="Submit"> </form> <?php if(isset($_POST['Submit'])){ header("Location: Seznamka.php"); print "<h1>Your comment has been submitted!</h1>"; $Name = $_POST['Name']; $Mail = $_POST['Mail']; $Predmet= $_POST['Predmet']; $Comment = $_POST['Comment']; #Get old comments $old = fopen("comments.txt", "r+t"); $old_comments = fread($old, 1024); #Delete everything, write down new and old comments $write = fopen("comments.txt", "w+"); $string = "<div class='ahoj'><i>Autor:</i> <b>".$Name."</b>".$Mail."<br> <i> Předmět:</i> ".$Predmet."<br>".$Comment."</br></div>\n".$old_comments; fwrite($write, $string,); fclose($write); fclose($old); } #Read comments $read = fopen("comments.txt", "r+t"); echo "<br><br>Comments<hr>".fread($read, 1024); fclose($read); ?> </table> <!-- #EndEditable "content" --></div> </html> <!-- End Content --> <!-- Begin Footer --> <div id="footer"> <table style="width: 100%"> Návrh a správa webu: </tr> </table> </div> <!-- End Footer --></div> <!-- End Container --> </body> <!-- #EndTemplate --> </html> JUST COMMENT SECTION HTML PHP <html> <link href="https://fonts.googleapis.com/css?family=Alegreya+Sans" rel="stylesheet"> <head> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <?php if(isset($_POST['Submit'])){ header("Location: Seznamka.php"); print "<h1>Your comment has been submitted!</h1>"; $Name = $_POST['Name']; $Mail = $_POST['Mail']; $Predmet= $_POST['Predmet']; $Comment = $_POST['Comment']; #Get old comments $old = fopen("comments.txt", "r+t"); $old_comments = fread($old, 1024); #Delete everything, write down new and old comments $write = fopen("comments.txt", "w+"); $string = "<div class='ahoj'><i>Autor:</i> <b>".$Name."</b>".$Mail."<br> <i> Předmět:</i> ".$Predmet."<br>".$Comment."</br></div>\n".$old_comments; fwrite($write, $string,); fclose($write); fclose($old); } #Read comments $read = fopen("comments.txt", "r+t"); echo "<br><br>Comments<hr>".fread($read, 1024); fclose($read); ?> </body> </html>
-
I am working on a project that is based of the the Huge PHP login Framework on Github. I am Working on adding in the other database tables for the users and I want to make it so I can see the data in the table on the admin page. The Admin index page has this implemented for the current table but I have created a page that is for the rest of less accessed information that an admin does not need to look at on a regular basis. I copy and pasted the getPublicProfilesOfAllUsers() from the UserModel.php and added it right below along with the changes to the code that I saw as necessary. Then I mapped the function and values on the admin controller page. I also created a basic html page that was based of the admin page that showed normal user information and I removed the code that I felt was not necessary. I know I have data in my Mysql Database in the table so I really don't know why its not being passed through to the html page. I have tried setting default values on the model page and still I get no information passed through to the webpage I don't know that I did wrong and it would be a big help if I could get some pointers. UserModel.php index.php private.php AdminController.php
- 3 replies
-
- php
- huge framework
- (and 4 more)
-
Hey guys, i need a little help. So i have a code with html and php, It is going to be just a simple comment section that write and read from TXT file, not from some database. and i need to style the string as u can see in code, is there any possible way ? (the reason im doing it this way is because i dont want MySQL) CODE: <html> <link href="https://fonts.googleapis.com/css?family=Alegreya+Sans" rel="stylesheet"> <head> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <form action="" method="POST"> <label> Vaše Jméno <input type="text" name="Name" class="Input" style="width: 225px" required> </label> <label> e-mail: <input type="text" name="Mail" class="Input" style="width: 225px" required> </label> <label> Předmět: <input type="text" name="Predmet" class="Input" style="width: 225px" required> </label> <br><br> <label> Vaše Zpráva: <br> <textarea name="Comment" class="Input" style="width: 300px" required></textarea> </label> <br><br> <input type="submit" name="Submit" value="Submit Comment" class="Submit"> </form> </body> </html> <?php if(isset($_POST['Submit'])){ header("Location: Seznamka.php"); print "<h1>Your comment has been submitted!</h1>"; $Name = $_POST['Name']; $Mail = $_POST['Mail']; $Predmet= $_POST['Predmet']; $Comment = $_POST['Comment']; #Get old comments $old = fopen("comments.txt", "r+t"); $old_comments = fread($old, 1024); #Delete everything, write down new and old comments $write = fopen("comments.txt", "w+"); $string = "<i>Autor:</i> <b>".$Name."</b> $Mail<br> <i> Předmět:</i> $Predmet<br>".$Comment."</br>\n".$old_comments; fwrite($write, $string,); fclose($write); fclose($old); } #Read comments $read = fopen("comments.txt", "r+t"); echo "<br><br>Comments<hr>".fread($read, 1024); fclose($read); ?> CSS: body{ font-family: 'Alegreya Sans', sans-serif; font-size: 20px } h1{ font-family: 'Alegreya Sans', sans-serif; font-size: 20px; color: red; } .Input{ font-family: 'Alegreya Sans', sans-serif; font-size: 20px; border: 1px solid orange; width: 300px; } .Submit{ font-family: 'Alegreya Sans', sans-serif; font-size: 20px; border: 1px solid orange; width: 300px; }
-
I have small problem with my php contact form code. I have my site using diacritics which does work perfectly. But my contact form input after submitting looks like this "ÄÅ¡Å" after using any [0-9] keys for diacritics. PHP file: <?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $service = $_POST['service']; $message = $_POST['message']; $from = $name; $to = 'info@email.com'; $subject = "$name - $service"; $body = "Jméno zákazníka: $name\nE-Mail zákazníka: $email\nTelefonní číslo: $phone\nservice: $service\nZpráva: $message "; if (mail ($to, $subject, $body, $from, $headers)) { $headers = array("Content-Type: text/html; charset=UTF-8"); } else { echo "Failed"; } ?> Output after submitting the contact form: First Last Name Jméno zákazníka: Name E-Mail zákazníka: email Telefonní císlo: phone number service: havárii Zpráva: Ä�Å¡Å� the "headers" as name, email, phone, service, message is written with diacritics BUT then the input for example here: Zpráva: ÄÅ¡Å is not supported for some reason. Also the html file include <meta charset="utf-8">
- 1 reply
-
- php
- contact-form
-
(and 2 more)
Tagged with:
-
Hi I want to open an existing Laravel project. The Project comes with a MySQL database. I am using Ubuntu 18.04 and I have managed to set up Xampp. I can now see the phpMyAdmin page if I visit localhost/phpmyadmin/ The project file and database are located at /home/USERNAME/projects/PROJECTNAME do I have to move the projects to a curtain folder or can I somehow make Xampp load this folder? I will be using Phpstorm and Datagrip to work on the project. I hope someone knows his/her way around Xampp. I somewhat know what I am doing but it's my first time setting this up so sometimes simple stuff is the hardest because there is no documentation. Thanks for helping Janick
-
Hi all, I am working on pulling data down from my server and have ran into a little issue and cant wrap my head around it. I have this script that generates a json output neatly but I want to expand it for when pulling multiple records down from my database. Right now the output looks like this: { "Testing01": { "name": "Scott", "number": null, "address": { "Line01": "123 fake street", "Line02": "Dublin", "Line03": "4", "Country": "Ireland" } } } But what I want to do is create a loop that will out put records like this: { "Testing01": { "name": "Scott", "number": null, "address": { "Line01": "123 fake street", "Line02": "Dublin", "Line03": "4", "Country": "Ireland" } }, "Testing02": { "name": "Mike", "number": null, "address": { "Line01": "321 fake street", "Line02": "Dublin", "Line03": "2", "Country": "Ireland" } } } If anyone at all can help me to create a method of printing nicely formatted json like the second example can you please share. Here is my code for the single output: <?php header('Content-Type: application/json'); $root = array( "Testing01" => array( "name" => "Scott", "number" => null, "address" => array( "Line01" => "123 fake street", "Line02" => "Dublin", "Line03" => "4", "Country" => "Ireland" ) ) ); echo json_encode($root, JSON_PRETTY_PRINT); ?> Thanks in advance.
-
Hey all, I taught myself Python recently and I want to learn some web development. I've been told that to build a website I'll need to know HTML, CSS, PHP and Javascript. Do I really need all of them to create a website? If so, what order should I learn them in? Also, where does Django fit into this? If I'm learning all these is it even worth learning, or should I do Django instead of these? Thanks for any help
-
Hi there, I am working on a project that requires files been uploaded to an S3 server and I ran into a problem with the Post request. My upload script works perfectly using the following AJax code: var form = new FormData(); let msg = $("#msg").val(); form.append('file', file); form.append('msg', msg); form.append('size', file.size); $.ajax({ url: 'upload.php', // point to server-side PHP script dataType: 'text', // what to expect back from the PHP script, if anything cache: false, contentType: false, processData: false, data: form, type: 'post', success: function(php_script_response){ alert(php_script_response); // display response from the PHP script, if any } }); However this is not the code I want to use as I have a progress bar linked to my other method that I want to use. Here is the code I am trying to use, it is calling my upload script but no FormData is been passed through at all. var form = new FormData(); let msg = $("#msg").val(); form.append('file', file); form.append('msg', msg); form.append('size', file.size); $(".uploader__share").addClass("hidden"); $(".uploader__progress").removeClass("hidden"); $("#msg").prop("readonly", true); const xhr = new XMLHttpRequest(); xhr.open("POST", 'upload.php', true); xhr.upload.addEventListener("progress", e => { const percent = e.lengthComputable ? (e.loaded / e.total) * 100 : 0; $(".progress-bar").width(percent.toFixed(5) + "%"); }); xhr.setRequestHeader("Content-Type", "text/plain"); xhr.send(form); I've also tried setting the "setRequestHeader" to: xhr.setRequestHeader("Content-Type", "multipart/form-data"); But nothing seems to be working. Can someone help me resole this please Thanks in advance!
-
Basically I need help if someone can guide or point me in the right direction to rewrite PHP logic in JavaScript What I want to do: In POSTMAN I need to POST payment request to online checkout. I have managed to fill the body form data, with all the needed key/values as I followed the documentation they provide (the place I need to post the request) but I stumbled upon the Signature as they require it to be calculated (not just copy pasted in the request) and the only example they provide is in PHP. Postman Pre-request script is only written in JavaScript so the PHP example they have can't be used. Any help would be appreciated, I've tried writing it on my own, but nothing seems to work, so a reading material or tips would be of a great help! This is the link to their PHP example that needs to be interpreted.
- 7 replies
-
- php
- javascript
-
(and 2 more)
Tagged with:
-
Hey guys, I want some educational advice over whether I should choose Python or MySQL and PHP as my specialization in the course I'm doing next year. The reason why I'm asking is because out of the 2 main tracks that are offered in the course (Web Dev or Software/Mobile Dev), I'm going with Web Dev and I'm unsure as to which specialization would help me more and be more worthwhile for doing web development in future? Thanks in advance for the advice! Regards A confused final year high school student Link for referencing (hope the link works): https://www.aie.ac/tcp-2_30_374-it-systems-developer-nqf5-computer-programmer.html
- 11 replies
-
My Remote user: 192.168.0.112 (windows, PHP with mysqli) My Mysql Server (ubuntu 20.04 lts) 192.168.0.105\ My Commands i have run so far: CREATE DATABASE web_search; USE web_search; CREATE TABLE IF NOT EXISTS `web_info` ( `id` int(11) NOT NULL, `meta_title` varchar(100) NOT NULL, `meta_description` varchar(300) NOT NULL, `site_url` varchar(300) NOT NULL, `platform` varchar(300) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=199 DEFAULT CHARSET=latin1; CREATE USER 'remote4'@'192.168.0.112' IDENTIFIED BY 'mypass'; GRANT ALL PRIVILEGES ON web_search.* TO 'remote4'@'192.168.0.112'; I get the Error "actively refused connection" On my Config.php: <?php $user = 'remote3'; $password = 'mylegitpasswod''; $database = 'web_search'; $db = new mysqli('192.168.0.105',$user,$password,$database,3306); ?> my error
-
So quick question, I am trying to check a value in a mysql database with php and just a simple check to see if it is at least a certain value, whats a good way to do this? Thanks <?php require("common.php"); if(empty($_SESSION['user'])) { header("Location: login.php"); exit("redirect: login.php"); } else { $query = " SELECT id, username, email, first, last, access_level FROM users "; } if($_SESSION['access_level'] <= 10) { exit("Access allowed"); } else{ header("Location: index.php"); exit("redirect: index.php"); } ?> <html> <head> <meta charset="utf-8"> <title>level 10 test</title> </head> <body> <p> level 10 test</p> </body> </html>
-
Hi! I am trying to host my own website so that I can show them to my friends. I have some html, css and javascript done for this site. BUT, I can't seem to understand how I do this. I tried to save my html file as php in "D:\WAMP\XAMPP\htdocs\MyFile.php". I then went to "localhost" on my browser, but it is looking like this https://gyazo.com/67d2a8b73b14cff569b4b2abddc8e0d6. What am I doing wrong? Can someone help me google this problem, because I can't find a solution to my problem.
-
I have all my files downloaded from the tutorial i followed to change the style of the basic ftp directory look and change it into a nice table. unfortunately the guide does not show you how to implement this into a website, nor does it work as it should. I dont know how to select the drive which i am using for my ftp server for a start, and i get an error when trying to run the .sorttable.js with error code 800A03EE . I COMPLETELY understand the risks with ftp. This is for my own education. I have sftp working and i understand completely opening up ports etc I am just wanting to see if i can change the look. I plan on hosting it off a seperate machine with firewalls etc installed. Any information about php, css or html would be MUCH appreciated. The files i have installed into my website folder are all linked in this post. thanks .index.php .sorttable.js .style.css .error.php .htaccess .index.php
-
Hello, trying to learn and use PHP. I use a php script to gather data from a xml file. and add a ?Storename="Netcdf:" to the php call ../php/script.php?Storename="Netcdf:" $url = "http://localhost:8080/geoserver/wms?version=1.3.0&request=GetCapabilities&service=WMS"; $str = file_get_contents( $url ); $storename = (string)$_GET['Storename']; $xml = simplexml_load_string( $str ); $returnArray = array(); //echo $storename; foreach($xml->Capability->Layer->Layer as $child) { if (strlen(strpos($child->Name, "Netcdf:" , 0 )) > 0 ) { //if (strlen(strpos($child->Name, $storename , 0 )) > 0 ) { array_push($returnArray, array('name' => (string)$child->Name, 'title' => (string)$child->Title, 'dimension' => (string)$child->Dimension)); } } echo json_encode($returnArray); echo $storename; The Code is working with the needle-string hardcoded but not when given with a variable ( see // if statement) I guess it has something to do with the return value not being 0 or 1 instead it is boolean. gettype($storename) is string echo $storename returns "Netcdf:" but the returned Array is empty when using $storename Does anybody has an idea as to why php not using my string as string?
-
foreach ($value->service as $service) { if (in_array($service, $request->service)) { $ok = true; } } "Undefined property: stdClass::$service" line 254 (the foreach line) foreach ($value->service as $service) { echo $service; } die(); "service1service2service3service4" foreach ($value->service as $service) { echo gettype($service); } die(); "stringstringstringstring" What's going on here? ($value->service is a collection and $request->service is a array) I have literary no clue whats going on here, I'd love if someone spots what I'm doing wrong.
-
Alright guys, I have been starring at this code and I cant figure out why I am getting this weird result in Chrome and Firefox. Basically, when I run the first for loop without an end of line the divs display correctly and fit within the parent div. When I add an EOL, whether it is be PHP_EOL or simply press enter between each line, the divs get a funky width or margin (im not sure which). However, when I inspect the divs in Chrome, all their properties are the same; but, as shown in the photo below, there is clearly a visual change! Can someone explain this to me? <div id="Container"> <? for ($i = 0; $i <= 10; $i++) { echo '<div class="StoreItem">'.$i.'</div>'; } for ($i = 0; $i <= 10; $i++) { echo '<div class="StoreItem">'.$i.'</div>'.PHP_EOL; } ?> </div> <style> #Container { position: fixed; top: 75px; left: 75px; right: 0px; bottom: 0px; overflow-y: auto; margin:5px; z-index: 0; } .StoreItem { display: inline-block; margin: 2%; height: 300px; background: red; font-size: 2em; font-weight: 700; text-align: center; width: 21%; } </style> In the image below, the divs created without and EOL output correctly and display 4 across. The second set of divs have an EOL and do not display correctly. <!-- Without EOL --> <div class="StoreItem">0</div><div class="StoreItem">1</div><div class="StoreItem">2</div><div class="StoreItem">3</div><div class="StoreItem">4</div><div class="StoreItem">5</div><div class="StoreItem">6</div><div class="StoreItem">7</div><div class="StoreItem">8</div><div class="StoreItem">9</div><div class="StoreItem">10</div><div class="StoreItem">0</div> <!-- With EOL --> <div class="StoreItem">1</div> <div class="StoreItem">2</div> <div class="StoreItem">3</div> <div class="StoreItem">4</div> <div class="StoreItem">5</div> <div class="StoreItem">6</div> <div class="StoreItem">7</div> <div class="StoreItem">8</div> <div class="StoreItem">9</div> <div class="StoreItem">10</div> Any help or information would be appreciated!
-
Well the title says it all really. I'm looking for ideas to practise web development (both front- and backend) and I'm hoping you guys can help me out ^^ Any and every idea is welcome!
-
Is it possible to auto-reload a webpage after a directory content change without a timer that checks the directory every minute and without manual reload? I need instant updates or something like the All Activity stream on this forum.
-
How can you sort an array based on it's version number? the usort works fine, but I don't see how I can use it on my array. array( array('id' => 1, 'version' => '1.3'), array('id' => 2, 'version' => '1.3.1'), array('id' => 3, 'version' => '1.3.2'), array('id' => 4, 'version' => '1.3.2-RC1'), array('id' => 5, 'version' => '1.3.2-RC2'), ); I'm trying to get this order 1.3.2 1.3.2-RC2 1.3.2-RC1 1.3.1 1.3 how can I get this to work?