Forums

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

Home Forums Back End Form Uplaod

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #32082
    hamanine
    Member

    HI, I am new to wordpress, but I am trying to send some information to my data base through this form, but when I click on submit, nothing happens would you please help?

    
    /*
    Template Name: template
    */
    ?>


    if (isset($_POST)){

    if (trim($_POST)==='') {
    $nameError="Please enter your name.";
    $hasError=true;
    } else {
    $name=trim($_POST);
    }
    if (!is_email($_POST)) {
    $nameError="Please Enter the right email";
    $hasError=true;
    } else {
    $email=is_email($_POST);
    }
    if (trim($_POST)==='') {
    $nameError="Please enter your nationality";
    $hasError=true;
    } else {
    $nationality=trim($_POST);
    }
    $user_photo=bloginfo('url')."/wp-content/uploads/".basename($_FILES);
    $user_cv=bloginfo('url')."/wp-content/uploads/".basename($_FILES);

    if (move_uplaoded_file($_FILES,$user_photo)){
    echo "Photo is uploaded";
    } else {
    echo "photo wasnt uploaded successfully";
    $hasError= true;
    }

    if (move_uplaoded_file($_FILES,$user_cv)){
    echo "Cv is uploaded";
    } else {
    echo "CV wasnt uploaded successfully";
    $hasError= true;
    }

    global $wpdb;
    if (!$hasError) {
    $wpdb->query($wpdb->prepare("
    INSERT INTO $wpdb->jobseekers
    (name, email, nationality, photo, cv, message)
    VALUES(%s, %s, %s, %s, %s, %s)",
    $name, $email, $nationality, $user_photo, $user_cv));

    }

    }

    ?>

























    #54707
    hamanine
    Member
    
    /*
    Template Name: template
    */
    ?>


    if (isset($_POST)){

    if (trim($_POST)==='') {
    $nameError="Please enter your name.";
    $hasError=true;
    } else {
    $name=trim($_POST);
    }
    if (!is_email($_POST)) {
    $nameError="Please Enter the right email";
    $hasError=true;
    } else {
    $email=is_email($_POST);
    }
    if (trim($_POST)==='') {
    $nameError="Please enter your nationality";
    $hasError=true;
    } else {
    $nationality=trim($_POST);
    }
    $user_photo=bloginfo('url')."/wp-content/uploads/".basename($_FILES);
    $user_cv=bloginfo('url')."/wp-content/uploads/".basename($_FILES);

    if (move_uplaoded_file($_FILES,$user_photo)){
    echo "Photo is uploaded";
    } else {
    echo "photo wasnt uploaded successfully";
    $hasError= true;
    }

    if (move_uplaoded_file($_FILES,$user_cv)){
    echo "Cv is uploaded";
    } else {
    echo "CV wasnt uploaded successfully";
    $hasError= true;
    }

    global $wpdb;
    if (!$hasError) {
    $wpdb->query($wpdb->prepare("
    INSERT INTO $wpdb->jobseekers
    (name, email, nationality, photo, cv, message)
    VALUES(%s, %s, %s, %s, %s, %s)",
    $name, $email, $nationality, $user_photo, $user_cv));

    }

    }

    ?>
    /




    //



















    #54671
    hamanine
    Member

    this is my action enctype=”multipart/form-data” name=”candidate” action=”” methode=”POST”

    #54673
    hamanine
    Member

    I tried also with action=”” but didn’t work either

    #54675
    guiniveretoo
    Member

    possibly just leave the action field blank? I’m not positive, but I think if

    < form action="" {etc}>

    it will reload the current page. Not absolutely positive, but worth a try?

    #54626
    JamesBarnsley
    Participant

    Use

    #54627
    JamesBarnsley
    Participant

    plus the move_uploaded_file function is wrong as well. You have spelling error in that.

    #54568
    hamanine
    Member

    Thank you very much, I fixed the spelling and I did use action=”#” and action=”” but didn’t work

    #54544
    hamanine
    Member

    it looks like my form isn’t working at all, even I tried to run it out side of wordpress but still not sending information action file

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Back End’ is closed to new topics and replies.