PHP

How to Pass an Object from PHP to Javascript and Back Again Using JSON

Many times I would like to pass an object from my PHP code to Javascript or from Javascript to PHP. JSON and a couple of PHP and Javascript functions make that easy! JSON is JavaScript Object Notation. Basically, it’s a textual way to represent an object. To demonstrate, I will create a PHP object: <?php […]

How to Pass an Object from PHP to Javascript and Back Again Using JSON Read More »

Using PHP's parse_url Function

This is a PHP function that I wish I had known about earlier, so I thought it was worth a mention for today’s Daily Web Tip. parse_url is a function that breaks a url down into it’s parts. <?php print_r(parse_url(‘https://cindycullen.com/example/test.php?id=255#faq1’)) ?> Will give you: Array ( [scheme] => http [host] => cindycullen.com [path] => /example/test.php

Using PHP's parse_url Function Read More »

How to Use PHP, JavaScript (or jQuery), and HTML Together

Sometimes for beginners, or even those of us that have been doing this for a while, it may be difficult to see how to use PHP and JavaScript together to make the page work correctly. I often have to stop and remind myself of the basics. HTML and JavaScript (which includes JavaScript libraries, such as

How to Use PHP, JavaScript (or jQuery), and HTML Together Read More »

Scroll to Top