Click here to Skip to main content
15,892,575 members
Everything / Programming Languages / PHP

PHP

PHP

Great Reads

by Tomas Petricek
Phalanger is a PHP language compiler for the .NET Framework which introduces PHP as a first-class .NET citizen.
by Member 4206974
FormGen, a JavaScript Form Generator
by Christoph Buenger
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
by Ozesh Thapa
Converting Docx To Html to Docx

Latest Articles

by Member 4206974
FormGen, a JavaScript Form Generator
by Dan Letecky
Weekly HTML5 event calendar with CSS themes, drag and drop support, date navigator. PHP and ASP.NET Core REST API backends.
by Jason Sultana
A look at some injection-style vulnerabilities
by Richard Chambers
Creating a simple VisionFive 2 RISC-V SBC web site using Apache2, PHP, and Postgres with the Mosquitto message broker and installing Golang, Java, and Rust.

All Articles

Sort by Updated

PHP 

U 30 Apr 2024 by Member 4206974
FormGen, a JavaScript Form Generator
1 Apr 2024 by Abed Al Rahman Hussien Balhawan
i have figured it out, by applying ob_clean(); // Clean the output buffer flush(); // Flush the output buffer before calling readfile().
31 Mar 2024 by Abed Al Rahman Hussien Balhawan
I have a php script that executes Python scripts for the desired excel workbook uploaded from a HTML by user interface, the script work fine, but when I am using readfile() function to download the current file after its being processed, I am...
29 Mar 2024 by Andre Oosthuizen
As stated above, you cannot run a client side app (vbscript) with a server side app (php). An alternative approach is to use a server-side scripting language like Python or Node.js, which have libraries and modules specifically designed for...
29 Mar 2024 by Abed Al Rahman Hussien Balhawan
i have a php script that executes a vbscript , the PHP scrip runs in xaamp, the issue is that the PHP script is executing successfully without executing the VBScript, when I trigger the VBScript manually (double click , it works fine) bellow is...
28 Mar 2024 by OriginalGriff
You cannot run applications on the client computer at all for security reasons: if you could do that then anyone could, including the spammers, phishers, and malicious members of society - and the problem of ransomware would be much, much more...
28 Mar 2024 by Dave Kreskowiak
If this is a web application and your PHP code is the server-side code, your Office operations will not work. The Office applications are not supported through COM-interop in a non-desktop app environment.
20 Mar 2024 by Patrice T
Quote: syntax error, unexpected token "public", expecting ";" or "{" Specifically, this error message tells you that the code before "public" ends with an incomplete line of code, probably missing a ";" at the end.
20 Mar 2024 by Andre Oosthuizen
Your real issue here is the version of PHP you are using, PHP versions prior to PHP 7.4 do not support typed properties so by attempting to declare a typed property like 'public string $version;' would result in a syntax error as you received. ...
19 Mar 2024 by Dan Letecky
Weekly HTML5 event calendar with CSS themes, drag and drop support, date navigator. PHP and ASP.NET Core REST API backends.
18 Mar 2024 by OriginalGriff
To add to what Dave has said, you should expect to get syntax errors every day, probably many times a day while you are coding - we all do regardless of how much experience we have! Sometimes, we misspell a variable, or a keyword; sometimes we...
18 Mar 2024 by Dave Kreskowiak
Look at the line before this one. The compiler is telling you it found the token "public" when it was expecting a ";" or "{" character, so the line(s) before the one you posted is where the problem actually is.
18 Mar 2024 by George Halstead
I recieved this error this morning and not sure what needs to be done to fix it. Please help. Quote: syntax error, unexpected token "public", expecting ";" or "{" Here is the line of code in question. public string $version; What I have...
17 Mar 2024 by Vivek Kumar
This preform is very helpful for programmers. The community is very helpful. I generally write programs in c# language, but I don't know php at advanced level. In a project I need to write some code in PHP. please help me... This example will...
17 Mar 2024 by Andre Oosthuizen
As I am all about PHP, I found this interesting to play around with, be forewarned though that there are WAY more to the below code than what is given, you have to insert certain security measures, you need to know how to start a session to grab...
16 Mar 2024 by OriginalGriff
As Maciej has said, this is not a code conversion service: we are not here to translate code for you. Even if we did, what you would end up with would not be "good code" in the target language – they are based on very different frameworks, and...
16 Mar 2024 by Maciej Los
We are not a "C# to PHP" translator. I'd suggest to read this: How to begin? | C# to PHP converter[^]
16 Mar 2024 by Member 16223854
The first thing you have to do is remove that sqaure brackets inside the name attributes and here you are solved
12 Mar 2024 by Jason Sultana
A look at some injection-style vulnerabilities
11 Mar 2024 by Andre Oosthuizen
In SQL, single quotes should be used for string values, not backticks. Also, there's a missing space before the 'SET' in your query which reads as - "UPDATE clinic_inventorySET. Your sql should look like - $sql = "UPDATE clinic_inventory SET "...
11 Mar 2024 by Raiden Peñaverde
Hello! I'm making a simple table for a school project and I've found this tutorial helpful "https://www.youtube.com/watch?v=NqP0-UkIQS4"> PHP and MySQL with CRUD Operations: Create, Read, Update, Delete - YouTube I followed everything but when it...
27 Feb 2024 by zjkal
I think it may be because some directories in your server, apache or www user lack permissions.
27 Feb 2024 by zjkal
It may be a server-side cache. First of all, you need to know what framework you are using? For example, the cache may be in the runtime folder of your code root directory, or other locations.
27 Feb 2024 by zjkal
This is just a small problem because the variable name in your second loop is wrong foreach ($grades as $ar_element) { echo $ar_element; foreach($ar_elementas $index => $value) { echo " Name: ".$index." , "; } }
27 Feb 2024 by zjkal
I feel it may be because your data table name contains spaces, because I have never used it like this before.
21 Feb 2024 by Raji Chandran
Fatal error: Uncaught mysqli_sql_exception: Table 'integral.students' doesn't exist in engine in C:\xampp\htdocs\bluehand\admin\students.php:148 Stack trace: #0 C:\xampp\htdocs\bluehand\admin\students.php(148): mysqli_query(Object(mysqli),...
20 Feb 2024 by OriginalGriff
Read the error message: it's very explicit: Error: Table 'integral.students' doesn't exist in engine We can't "solve" that, we have no idea which DB you are accessing or what tables it contains - and no way to access your system to find out! ...
16 Feb 2024 by OriginalGriff
Start here: PHP Form Handling[^]
16 Feb 2024 by Darshan Hiranandani
Hi everyone I am darshan hiranandani. I am a bit stuck on how to properly process form submissions PHP use the POST method. Could someone walk me through the steps or point me to a helpful resource? What I have tried: If anyone has expertise...
11 Feb 2024 by OriginalGriff
Repost: Deleted. Please do not repost your question; use the Improve question widget to add information or reformat it, but posting it repeatedly just duplicates work, wastes time, and annoys people. I'll delete this one.
10 Feb 2024 by LB2371
$nums = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X']; $str = preg_replace_callback('/\b(I|II|III|IV|V|VI|VII|VIII|IX|X)\b/', fn($m) => array_search($m[0], $nums) +1, $str); // $str = preg_replace_callback('/\b('.implode('|',...
8 Feb 2024 by Dave Kreskowiak
Yes, Outlook considers the signature as part of the email body. It's just something that gets pre-populated on a new email. If you specify the signature in a mailto link, Outlook will skip adding the signature to the email and replace the body...
8 Feb 2024 by Joan M
Hello all, INTRODUCTION (jump to the question if you want) Every month I end up navigating through the sent mails to find the last mail I sent to that specific customer, then copy the contents, create a new mail, paste the contents, copy the...
7 Feb 2024 by Richard Deeming
Unsurprisingly, the change event fires when the selected value is changed. It does not fire when the page first loads. You can either manually trigger the change event when the page loads: $('#programid').change(function() { ......
7 Feb 2024 by nyt1972
Hello, I have two dropdown boxes program and course, the program dropdown is populated programmatically and I want when it gets a value in other words when its value get changed then the course dropdown need to be populated based the program...
6 Feb 2024 by Richard Deeming
Quote: html += ''+data[i].course+''; Your generated HTML is invalid - you are adding the invalid attribute "option:selected" to your option element. The attribute is simply called...
6 Feb 2024 by nyt1972
Hello, I want an option to be selected in the course dropdown if it equals a certain value. Course dropdown will be randomly populated each time one select a program from the program dropdown. I have two dropdown boxes program and course, when...
6 Feb 2024 by virgin anantatur
I use XAMPP to connect to localhost. So when I edit the program code, it doesn't change when I run it. When I searched for a solution on Google it said delete the browser cache, but after I deleted it the results were the same and didn't change....
6 Feb 2024 by Andre Oosthuizen
You are almost on the right track. You can modify your '.htaccess' file by adding 'ErrorDocument 403 /redirect.php' - ErrorDocument 403 /redirect.php SetEnvIf CF-Connecting-IP "^103\.111\.227\.224$" ALLOWED_IP=1 SetEnvIf CF-Connecting-IP...
6 Feb 2024 by Andre Oosthuizen
In addition to the above and your comment - Your problem is that 'str_replace' performs replacements in the order they appear in your array as mentioned above. You can use the 'strtr' function (PHP strtr Function[^]) along with a custom...
6 Feb 2024 by gachia net
hi I have a WooCommerce store website. I use this code to sort products based on inventory. But the code has an error. It dosent work corretct.please guide me. How to sort WordPress site products based on inventory? What I have tried: ...
6 Feb 2024 by OriginalGriff
we can't help you: we have no access to your inventory data, no idea what the error message (if any) is, or any idea what you expected or got. So, it's going to be up to you. Fortunately, you have a tool available to you which will help you find...
5 Feb 2024 by Peter_in_2780
As documented at PHP: str_replace - Manual[^], str_replace() matches from first to last. To do what you want, you need to put all search strings BEFORE any prefixes of them, so an order like IV IX III II I VIII VII VI V X should work.
5 Feb 2024 by LB2371
I have a string that contains words and one or more roman numerals from one (I) to ten (X). I need to replace those numerals with integers. This is what I tried: $reps = [ 'I' => 1, 'II' => 2, 'III' => 3, 'IV' => 4, 'V' => 5, 'VI' => 6, 'VII'...
4 Feb 2024 by FX Magician
ServerName admin.fxmagician.com ServerAlias www.admin.fxmagician.com DocumentRoot /var/www/admin.fxmagician.com/public/ Options All -Indexes AllowOverride All Require...
29 Jan 2024 by Peter_in_2780
Your array_fill() is the culprit. Take a look at what you are putting after VALUES ( implode(',',array_fill(0,count($col),implode(',', $input))) It's effectively evaluated right to left because of the nested function calls, so take the first...
29 Jan 2024 by Nicholas Lombardi
I have a form where I expect many blank input text boxes (standard html) I need to insert records, with the INSERT statement ignoring those fields which do not have input values. For context, I take the POST variables in the usual way: if...
28 Jan 2024 by Mike-MadBadger
Presuming that you are using the Distance Matrix API (and not the Directions API) then the form of a request should be : https://maps.googleapis.com/maps/api/distancematrix/outputFormat?parameters And your code should look something like this :...
27 Jan 2024 by C line Taxi
Hi i am building a software for Taxi company and i want to Calcuate distance from pickup point to drop off and the will provide the fare. how can i acheive this using PHP What I have tried: i already tried using distance api but it is not...
27 Jan 2024 by nyt1972
Hello, I have a CodeIgniter project it works fine when I use it on localhost (XAMPP) but when I run it online and submit the form below it gives me You don't have permission to access this resource. Form is:
25 Jan 2024 by ThePotty1
Hi Apologies, I'm figuring this out as I go along, so I might state the obvious, or not state something that I should. This probably isn't even the right place to ask, but I suspect there are other devs here who've had to figure this out in...
25 Jan 2024 by ThePotty1
Morning. I'm going to post my findings as a solution, because I feel it helps to keep the initial symptoms I experienced separate from my final analysis. So. Navigate to your web page using your browser, and turn developer tools on. Click the...
24 Jan 2024 by Andre Oosthuizen
Looking at your link given, you are going about this the wrong way, PHP is supposed to be your backend and javascript/jquery you front end looking at your post... You are adding multiple loads to your requests on you server which responds in slow...
9 Jan 2024 by OriginalGriff
It says "Unclosed '{' on line 26", not "Missing '{' on line 26" - which means it's not looking for you to add another '{' but to add a matching '}' to "close" the one it found. So find line 26:Route::middleware('auth')->group(function () { And...
3 Jan 2024 by Richard MacCutchan
Try this: foreach($grades as $index => $value) { echo " Name: ".$index." , value: "; print_r($value); } or this foreach($grades as $index => $value) { echo " Name: ".$index." , values: "; foreach($value as $elt) echo...
3 Jan 2024 by Rama2F
Problem/Question: Print the following multidimensional array, using foreach. $grades = array( "ali"=>array("php","50"), "sami"=>array("php","77"), "rami"=>array("php" ) ); What I have tried: My code so far... foreach ($grades as...
27 Dec 2023 by OriginalGriff
Don't do it like that! Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead. When you...
26 Dec 2023 by OriginalGriff
Answered only to remove from unanswered queue - solved by OP.
26 Dec 2023 by nyt1972
Hello, I wanted my PHP form to be submitted at end of duration, for example the duration is 5 minutes, so as the time reach to 0 the form submits automatically. I tried the below but it submits the form immediately while I want it to be...
25 Dec 2023 by Dave Kreskowiak
Assuming you posted the contact.php code in your question, your fetch call to contact.php is expecting a json formatted response, not a HTML page, which is what your code is returning. Google for "php json response" to find out how to do that....
24 Dec 2023 by Member 14746205
Hello guys. I am a beginner at coding. I have very small knowledge of php . I have created a webpage containing a form. When the form is submitted a mail needs to be send via phpmailer to a specific mail , and when there are errors the form can...
22 Dec 2023 by Andre Oosthuizen
PHP has nothing to do with what you want, it only fetches the images and post them on your page being a server side tool. You are looking for a CSS solution that will show thumbnails and then a user clicks on a thumbnail, open large image, once...
21 Dec 2023 by Eric Reitsma 2023
I have this script from a friend who has passed away It shows the images sorted by time and date. It works OK by clicking the thumb but I want to view the image into borders and close it by clicking outside the borders What I have tried: ...
19 Dec 2023 by Andre Oosthuizen
Your error is most probably occurring because your query execution 'mysqli_query($conn, $sql)' is failing, and as a result, '$result' is not an object with your 'num_rows' property. You should check if your query execution is successful, add some...
19 Dec 2023 by Andre Oosthuizen
Your best and safest way is to make use of your session that you already declared in your 'button_clicked.php' page - Quote: Session variables works by storing user information to be used across multiple pages (e.g. username, course names, etc)....
18 Dec 2023 by Richard MacCutchan
The problem is that $result does not contain anything. Most likely the SQL call at line 74 failed, but you forgot to check it.
18 Dec 2023 by Blessing Banda
I am trying to fetch information from DB about all exam student takes and export the data to Csv but i am getting this error,
18 Dec 2023 by Ojazy Moi
I have a dynamic button, when clicked (Course Outline), retrieves mysql db record ID and redirects to a page. I want it to fetch all data associated the clicked ID and display on same page though different course outlines. which is not working. ...
18 Dec 2023 by pasztorpisti
Have some balls and don't be afraid to choose your destiny for yourself. Do you want us to tell you what to do with your life??? (Hmmm, a few tips from me: go and try working as a makeup artist or a ballet dancer...) If you have no clue about any...
18 Dec 2023 by Andre Oosthuizen
Your error is most probably at this line - $ion_user_id = $this->db->get_where('users', array('email' => $email))->row()['id']; It refers to the name you are using 'id', which is undefined, meaning that the name does not exist in your array. ...
17 Dec 2023 by Sapientissime
Je reçois cette erreur: Une erreur PHP a été rencontrée Severity: Avertissement Message: Undefined array key "id" Nom du fichier: controllers/patient.php Numéro de la ligne: 353 voici le code: if (empty($id)) { // Adding New Patient ...
16 Dec 2023 by Richard Chambers
Creating a simple VisionFive 2 RISC-V SBC web site using Apache2, PHP, and Postgres with the Mosquitto message broker and installing Golang, Java, and Rust.
9 Dec 2023 by Arambar Company
Hello, I have a system in which a number of drivers are supposed to register and work. There are also some individuals who act as owners of goods. The owners of goods can announce their loads in their own panel, and the drivers can see these...
8 Dec 2023 by Dave Rave
Try mPDF instead mPDF – mPDF Manual[^]. I am using it in similar use case and works flawlesly.
8 Dec 2023 by Dave Rave
Instead of developing everything from scratch why don't you use existing parser like Simple HTML DOM documentation[^] ? This one works very well and will save you hours of development. The rest is easy - the queue of links to process etc. I'd...
4 Dec 2023 by Member 16155723
We resolved this issue by changing the cpanel password from WHM(not from cpanel) with mysql synch checkbox selected . goto WHM>password modification>enter password (select synch mysql checkbox selected). After that login to cpanel with new...
2 Dec 2023 by Dave Kreskowiak
Change the query to this: INSERT INTO record VALUEs ('', '$name', '$email', '$mobile', '$date') Note the absence of quotes around the table name and the trailing comma after the '$date' parameter. The standard query format for an INSERT is: ...
2 Dec 2023 by Arenuel Ict Firm
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''record' values('', 'rr', 'emma@gmail.com', 'ffvf',...
28 Nov 2023 by Andre Oosthuizen
a Little late but the following to point you in the right direction - Your code is very "loose" and mixed, there are many easier ways to echo out values to see if a correct item(character, array, variable etc) is returned from a line of code,...
25 Nov 2023 by Kendra Roberts
Writing in PHP to execute a SQL statement and the below is failing at $test_query = "SELECT NAME,EMAIL,PASSWORD FROM AGENTS WHERE EMAIL='b'"; "; echo $database; echo ""; echo $username; echo ""; echo $password; echo ""; ...
24 Nov 2023 by s.s.scriptties
I've made a PHP web crawler and then made a MySQL table called "dex" as in index, then I connected to the database through PDO and tweaked the code to "INSERT" websites that aren't already crawled into the table, "UPDATE" for websites that are...
23 Nov 2023 by Member 16147099
try { $mail = new PHPMailer(); $mail->SMTPDebug = SMTP::DEBUG_SERVER; $mail->isSMTP(); $mail->Host = 'amtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = 'ali@gmail.com'; //Your email address...
20 Nov 2023 by Andre Oosthuizen
No... The session_start() function must be the very first thing in your document. Before any HTML tags or other code. Also check if a session is running, if not then start it... Start a PHP Session[^] if (session_status() == PHP_SESSION_NONE)...
19 Nov 2023 by Member 16143475
17 Nov 2023 by cheekycroak
I had another expert help me to resolve the issue. Below is the code for any future reference in case anyone is stuck like me. Appreciate everyone's help and time to reach a solution. $url = trim($playlistSong->filename); $url =...
17 Nov 2023 by cheekycroak
The code filename; ?> reads the path from a database table. In order for the html5 player to play the song it requires the local path that resides in the database table to be converted to an absolute URL path. The...
15 Nov 2023 by Andre Oosthuizen
Richard has given you a close to perfect solution but it returned the same path to your D: drive as to where you wanted a result of the online url, I have edited it a little which results in the exact output you require. I have hardcoded your...
14 Nov 2023 by Richard MacCutchan
It appears that the str_replace function sees the sequence \200 and removes it. As the result from your code gives: https://mywebsite.com/Music0 Hits/Album.Mp3 So using the following code: $url = "D:\Music\2000 Hits\Album.Mp3"; $urlb...
11 Nov 2023 by Andre Oosthuizen
As Richard pointed out, your code will never run as you have a very important part missing that should load the image. As mentioned as well, you need php code to obtain the image from your server file using your path and image name specified in...
11 Nov 2023 by Member 13322574
my image not showing... dbname=image table name=images filedname= id, name, imagename the below line is error '; ?> What I have tried: Display the Image ...
10 Nov 2023 by Richard MacCutchan
You are missing the opening
7 Nov 2023 by Gerry Schmitz
I didn't see any "session_start()". Quote: Note: The session_start() function must be the very first thing in your document. Before any HTML tags. PHP Sessions[^]
7 Nov 2023 by Сергей Свириденко
This is what index.php looks like, where the user registers: php Registration Login Password Repeat password Registration Already registered? ...
3 Nov 2023 by Alessio Torregrossa
I'm using woocommerce on my Wordpress. I created a code that I'll show you below. I put it inside function.php and a js called custom-fields.js. As you can see in this image[^], each customer with email has different prices so the customer will...