Purpose: Call a PHP function to read data from a file and rewrite it. I used PHP only for this purpose - FileIO - and I\'m new to PHP.
Solution
You don't need javascript for doing so. Just delete the onClick and write the php Admin.php
file like this:
alert('Data not existed!')";
}
else{
$contact_list = $contact_list . addNewContact();
file_put_contents("data/data.json", $contact_list);
}
fclose($datafile);
}
// Call the function saveContact()
saveContact();
echo "Thank you for joining us";
}
else //If the form is not submited or not all the required fields are filled
{ ?>
Thought I don't like the PHP bit. Do you REALLY want to create a file for contacts? It'd be MUCH better to use a mysql database. Also, adding some breaks to that file would be nice too...
Other thought, IE doesn't support placeholder.