Write the PHP code to manage an address book using JSON.
You are given the HTML and JS.
The JS code sends requests to your addressbook.php
web service that reads and saves address data.
(sample solution)
(solution)
Write the PHP file, addressbook.php
, that provides the following behavior:
addressbook.php
with no parameters outputs an array of names:
{"names": ["Suzie", "Billy", ...]}
name
parameter outputs that person's address:
{"name": "Billy", "address": "123 4th St."}
name
and address
parameter saves that person in the address book.
You may assume that any necessary parameters are passed and are in valid formats.