Chapter 10. Working with Ajax and PHP

<feature><title>In This Chapter</title> <objective>

Understanding the basic PHP syntax

</objective>
<objective>

Extracting data from HTML controls

</objective>
<objective>

Sending data to the server

</objective>
<objective>

Reading and writing files on the server

</objective>
<objective>

Handling databases with PHP

</objective>
</feature>

The CEO says, “No, we can’t just have static data returned from the server. We need to send data to the server from our Ajax code and have customized data returned from the server. How can we do it?”

You, the highly-paid Ajax consultant, step up and say, “No problem. How about using PHP on the server to handle your data interactively?”

“Sounds great,” says the CEO. “I hope your rates are reasonable?”

“Nope,” you say.

“Darn,” says the CEO.

Ajax applications often interact with programming code on the server, and these days, the most frequent choice is PHP. Ajax programmers typically don’t need a great deal of in-depth coding on the server, but if you want to write your own PHP scripts, knowing the basics is important — and that’s what this chapter gives you: the PHP basics.

Because Ajax involves server-side programming, this chapter focuses on working with PHP on the server. If you can handle JavaScript, you can handle PHP. In fact, much of the syntax is very similar, so you’ve already got a big leg up.

Note that this chapter is just a PHP primer — I couldn’t possibly fit all of PHP in these pages. If you need more than what ...

Get Ajax For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.