Time for action – retrieving data from the form post

When pressing the save button, the form values are posted to the server. The form_save function needs to retrieve these values and store them into the database. Let's look at how the different parts of this function work.

As the data is going to be used for updating the Cacti database, it's always a good idea to make it more secure by using the available mysql_escape_string function:

// Retrieve the data from the form post /* Add hostId statement here */ if (isset ($_POST['longitude'])) { $s_dataLongitude = mysql_escape_string($_POST['longitude']); } if (isset ($_POST['latitude'])) { $s_dataLatitude = mysql_escape_string($_POST['latitude']); } if (isset ($_POST['contactAddress'])) { $s_dataContactAddress ...

Get Cacti 0.8 Beginner's Guide 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.