- This topic is empty.
-
AuthorPosts
-
March 21, 2011 at 7:26 pm #32082hamanineMember
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));
}
}
?>
March 21, 2011 at 7:28 pm #54707hamanineMember/*
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));
}
}
?>
/
//
March 21, 2011 at 7:29 pm #54671hamanineMemberthis is my action enctype=”multipart/form-data” name=”candidate” action=”” methode=”POST”
March 21, 2011 at 7:32 pm #54673hamanineMemberI tried also with action=”” but didn’t work either
March 21, 2011 at 8:04 pm #54675guiniveretooMemberpossibly 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?
March 22, 2011 at 12:13 pm #54626JamesBarnsleyParticipantUse
March 22, 2011 at 12:14 pm #54627JamesBarnsleyParticipantplus the move_uploaded_file function is wrong as well. You have spelling error in that.
March 22, 2011 at 6:02 pm #54568hamanineMemberThank you very much, I fixed the spelling and I did use action=”#” and action=”” but didn’t work
March 22, 2011 at 6:36 pm #54544hamanineMemberit 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
AuthorPostsViewing 9 posts - 1 through 9 (of 9 total)- The forum ‘Back End’ is closed to new topics and replies.