13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

878 Chapter 34 Building <strong>Web</strong> 2.0 Applications with Ajax<br />

Figure 34.5<br />

Adding a bookmark after the first pass of editing the<br />

add_bms.php script.<br />

To remove the duplicate message regarding the user’s login name, delete this line from<br />

add_bms.php:<br />

check_valid_user();<br />

The check for valid user will have already been done when the add_bms_form.php page<br />

was loaded; you wouldn’t be on the page that invokes Ajax functionality if you weren’t<br />

found to be a valid user.<br />

The next step is to remove the outer try block <strong>and</strong> the exception h<strong>and</strong>ling.The reason<br />

for this is because you want the script to get to the end in which the list of URLs<br />

already stored is displayed for the user.This means some adjustments will be made along<br />

the way to reintroduce error text as necessary. Listing 34.9 shows an amended version of<br />

add_bms.php.<br />

Listing 34.9<br />

An Amended Version of add_bms.php<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!