The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Need help converting Standard PHP Post request to AJAX…

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #37607

    I am kicking myself in the arse here because i can’t for the life of me figure it out…this is supposed to be a quick and dirty project, but, I decided i want to try something new, and I have little to no experience with the AJAX methods in jQuery…Any help would be more than appreciated, thanks guys!

    Again, I am wondering how to go about converting this standard request to AJAX using jQuery…

    here is my form & php



    if (isset($_POST)) {
    if (!empty($_POST)) {
    if ($_GET == 'newCategory') {
    $categories = $_POST;
    $query = "SELECT * FROM categories WHERE category ='$categories' ";
    $result = mysql_query($query) or die(mysql_error());
    if (mysql_num_rows($result)) {
    echo '';
    } else {
    // Simply cleans any spaces
    $clean = str_replace(' ', '', $categories);
    // Makes it possible to add multiple categories delimited by a comma
    $array = explode(",", $clean);
    foreach ($array as &$newCategory) {
    mysql_query("INSERT INTO categories (category) VALUES ('$newCategory')");
    echo "";
    } else {
    echo "";
Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.