Envoi de fichiers par mail
Posté : 16 nov. 2013, 17:38
Bonjour à tous,
En tant que VRAI débutant PHP, je galère pour faire un envoi de fichiers.
J'ai un gros formulaire qui envoie beaucoup d'infos par e-mail. Sans doute mal écrit mais ca fonctionne à peu près.
Formulaire :
Le formulaire est visible ici : http://eikona.fr/ASC/espace-emploi/nous-rejoindre.html
J'ai lu beaucoup de chose mais je ne suis pas capable d'adapter dans mon cas.
La plupart des tutoriels ne parlent que de l'upload. Mais déjà ça je n'ai pas réussi à le faire...
Désolé. Merci de bien vouloir m'aiguiller un peu.
En tant que VRAI débutant PHP, je galère pour faire un envoi de fichiers.
J'ai un gros formulaire qui envoie beaucoup d'infos par e-mail. Sans doute mal écrit mais ca fonctionne à peu près.
Formulaire :
<!-- DEBUT FORMULAIRE -->
<form method="post" action="index.php?option=com_jumi&view=application&fileid=5" enctype="multipart/form-data">
<label for="prestation" class="h4">POUR QUELLE PRESTATION<span class="e">*</span><select name="prestation" style="width: auto;" type="text"><option>Select</option><option>Hôte / hôtesse standardiste</option><option>Hôte / hôtesse d’accueil événementiel</option><option>Téléconseiller</option><option>Télévendeur</option><option>Technicien hotline</option><option>Technicien des services généraux</option><option>Technicien courrier</option></select></label>
<p class="text"><label for="type-contrat" class="h4">QUEL CONTRAT RECHERCHEZ-VOUS ?<span class="e">*</span></label>
<input type="checkbox" id="type-contrat" name="cdi" value="- CDI " />CDI
<input type="checkbox" id="type-contrat" name="cdd" value="- CDD " />CDD<br />
<input type="checkbox" id="type-contrat" name="tplein" value="- Temps plein " />Temps plein
<input type="checkbox" id="type-contrat" name="tpartiel" value="- Temps partiel " />Temps partiel
<input type="checkbox" id="type-contrat" name="missions" value="- Missions " />Missions</p>
<p class="text"><label for="disponibilites" class="h4">QUELLES SONT VOS DISPONIBILITÉS ?<span class="e">*</span></label>
<input type="checkbox" id="disponibilites" name="semaine" value="- Semaine " />Semaine
<input type="checkbox" id="disponibilites" name="jour" value="- Journée " />Journée
<input type="checkbox" id="disponibilites" name="soir" value="- Soirée " />Soirée
<input type="checkbox" id="disponibilites" name="nuit" value="- Nuit " />Nuit
<input type="checkbox" id="disponibilites" name="we" value="- Week-end " />Week-end</p>
<p class="text"><label for="jours" class="text">En cas de journée(s) complète(s), vos préférences <span class="e">*</span> : </label>
<input type="checkbox" id="jours" name="lun" value="- Lundi " />Lundi
<input type="checkbox" id="jours" name="mar" value="- Mardi " />Mardi
<input type="checkbox" id="jours" name="mer" value="- Mercredi " />Mercredi
<input type="checkbox" id="jours" name="jeu" value="- Jeudi " />Jeudi
<input type="checkbox" id="jours" name="ven" value="- Vendredi " />Vendredi
<input type="checkbox" id="jours" name="sam" value="- Samedi " />Samedi <br />
<input type="checkbox" id="jours" name="dim" value="- Dimanche " />Dimanche </p>
<!-- DEBUT CANLENDRIER -->
<table class="ds_box" cellpadding="0" cellspacing="0" id="ds_conclass" style="display: none;">
<tr><td id="ds_calclass">
</td></tr>
</table>
<script type="text/javascript">
// <!-- <![CDATA[
// Project: Dynamic Date Selector (DtTvB) - 2006-03-16
// Script featured on JavaScript Kit- http://www.javascriptkit.com
// Code begin...
// Set the initial date.
var ds_i_date = new Date();
ds_c_month = ds_i_date.getMonth() + 1;
ds_c_year = ds_i_date.getFullYear();
// Get Element By Id
function ds_getel(id) {
return document.getElementById(id);
}
// Get the left and the top of the element.
function ds_getleft(el) {
var tmp = el.offsetLeft;
el = el.offsetParent
while(el) {
tmp += el.offsetLeft;
el = el.offsetParent;
}
return tmp;
}
function ds_gettop(el) {
var tmp = el.offsetTop;
el = el.offsetParent
while(el) {
tmp += el.offsetTop;
el = el.offsetParent;
}
return tmp;
}
// Output Element
var ds_oe = ds_getel('ds_calclass');
// Container
var ds_ce = ds_getel('ds_conclass');
// Output Buffering
var ds_ob = '';
function ds_ob_clean() {
ds_ob = '';
}
function ds_ob_flush() {
ds_oe.innerHTML = ds_ob;
ds_ob_clean();
}
function ds_echo(t) {
ds_ob += t;
}
var ds_element; // Text Element...
var ds_monthnames = [
'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin',
'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'Décembre'
]; // You can translate it for your language.
var ds_daynames = [
'Dim', 'Lun', 'Mar', 'Me', 'Jeu', 'Ven', 'Sam'
]; // You can translate it for your language.
// Calendar template
function ds_template_main_above(t) {
return '<table cellpadding="3" cellspacing="1" class="ds_tbl">'
+ '<tr>'
+ '<td class="ds_head" style="cursor: pointer" onclick="ds_py();"><<</td>'
+ '<td class="ds_head" style="cursor: pointer" onclick="ds_pm();"><</td>'
+ '<td class="ds_head" style="cursor: pointer" onclick="ds_hi();" colspan="3">Fermer</td>'
+ '<td class="ds_head" style="cursor: pointer" onclick="ds_nm();">></td>'
+ '<td class="ds_head" style="cursor: pointer" onclick="ds_ny();">>></td>'
+ '</tr>'
+ '<tr>'
+ '<td colspan="7" class="ds_head">' + t + '</td>'
+ '</tr>'
+ '<tr>';
}
function ds_template_day_row(t) {
return '<td class="ds_subhead">' + t + '</td>';
// Define width in CSS, XHTML 1.0 Strict doesn't have width property for it.
}
function ds_template_new_week() {
return '</tr><tr>';
}
function ds_template_blank_cell(colspan) {
return '<td colspan="' + colspan + '"></td>'
}
function ds_template_day(d, m, y) {
return '<td class="ds_cell" onclick="ds_onclick(' + d + ',' + m + ',' + y + ')">' + d + '</td>';
// Define width the day row.
}
function ds_template_main_below() {
return '</tr>'
+ '</table>';
}
// This one draws calendar...
function ds_draw_calendar(m, y) {
// First clean the output buffer.
ds_ob_clean();
// Here we go, do the header
ds_echo (ds_template_main_above(ds_monthnames[m - 1] + ' ' + y));
for (i = 0; i < 7; i ++) {
ds_echo (ds_template_day_row(ds_daynames[i]));
}
// Make a date object.
var ds_dc_date = new Date();
ds_dc_date.setMonth(m - 1);
ds_dc_date.setFullYear(y);
ds_dc_date.setDate(1);
if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
days = 31;
} else if (m == 4 || m == 6 || m == 9 || m == 11) {
days = 30;
} else {
days = (y % 4 == 0) ? 29 : 28;
}
var first_day = ds_dc_date.getDay();
var first_loop = 1;
// Start the first week
ds_echo (ds_template_new_week());
// If sunday is not the first day of the month, make a blank cell...
if (first_day != 0) {
ds_echo (ds_template_blank_cell(first_day));
}
var j = first_day;
for (i = 0; i < days; i ++) {
// Today is sunday, make a new week.
// If this sunday is the first day of the month,
// we've made a new row for you already.
if (j == 0 && !first_loop) {
// New week!!
ds_echo (ds_template_new_week());
}
// Make a row of that day!
ds_echo (ds_template_day(i + 1, m, y));
// This is not first loop anymore...
first_loop = 0;
// What is the next day?
j ++;
j %= 7;
}
// Do the footer
ds_echo (ds_template_main_below());
// And let's display..
ds_ob_flush();
// Scroll it into view.
//ds_ce.scrollIntoView();
}
// A function to show the calendar.
// When user click on the date, it will set the content of t.
function ds_sh(t) {
// Set the element to set...
ds_element = t;
// Make a new date, and set the current month and year.
var ds_sh_date = new Date();
ds_c_month = ds_sh_date.getMonth() + 1;
ds_c_year = ds_sh_date.getFullYear();
// Draw the calendar
ds_draw_calendar(ds_c_month, ds_c_year);
// To change the position properly, we must show it first.
ds_ce.style.display = '';
// Move the calendar container!
the_left = ds_getleft(t);
the_top = ds_gettop(t) + t.offsetHeight;
ds_ce.style.left = the_left + 'px';
ds_ce.style.top = the_top + 'px';
// Scroll it into view.
//ds_ce.scrollIntoView();
}
// Hide the calendar.
function ds_hi() {
ds_ce.style.display = 'none';
}
// Moves to the next month...
function ds_nm() {
// Increase the current month.
ds_c_month ++;
// We have passed December, let's go to the next year.
// Increase the current year, and set the current month to January.
if (ds_c_month > 12) {
ds_c_month = 1;
ds_c_year++;
}
// Redraw the calendar.
ds_draw_calendar(ds_c_month, ds_c_year);
}
// Moves to the previous month...
function ds_pm() {
ds_c_month = ds_c_month - 1; // Can't use dash-dash here, it will make the page invalid.
// We have passed January, let's go back to the previous year.
// Decrease the current year, and set the current month to December.
if (ds_c_month < 1) {
ds_c_month = 12;
ds_c_year = ds_c_year - 1; // Can't use dash-dash here, it will make the page invalid.
}
// Redraw the calendar.
ds_draw_calendar(ds_c_month, ds_c_year);
}
// Moves to the next year...
function ds_ny() {
// Increase the current year.
ds_c_year++;
// Redraw the calendar.
ds_draw_calendar(ds_c_month, ds_c_year);
}
// Moves to the previous year...
function ds_py() {
// Decrease the current year.
ds_c_year = ds_c_year - 1; // Can't use dash-dash here, it will make the page invalid.
// Redraw the calendar.
ds_draw_calendar(ds_c_month, ds_c_year);
}
// Format the date to output.
function ds_format_date(d, m, y) {
// 2 digits month.
m2 = '00' + m;
m2 = m2.substr(m2.length - 2);
// 2 digits day.
d2 = '00' + d;
d2 = d2.substr(d2.length - 2);
// YYYY-MM-DD
return d2 + ' ' + m2 + ' ' + y;
}
// When the user clicks the day.
function ds_onclick(d, m, y) {
// Hide the calendar.
ds_hi();
// Set the value of it, if we can.
if (typeof(ds_element.value) != 'undefined') {
ds_element.value = ds_format_date(d, m, y);
// Maybe we want to set the HTML in it.
} else if (typeof(ds_element.innerHTML) != 'undefined') {
ds_element.innerHTML = ds_format_date(d, m, y);
// I don't know how should we display it, just alert it to user.
} else {
alert (ds_format_date(d, m, y));
}
}
// And here is the end.
// ]]> -->
</script>
<label for="dispo" class="text">A partir de quand êtes-vous disponible ?<span class="e">*</span><input onclick="ds_sh(this);" name="dispo" style="cursor: text; width: 80px; margin-left: 12px; padding-right: 30px; background-image: url(/images/calendrier.png) top right no-repeat;" type="text" /></label>
<!-- FIN CALENDRIER -->
<label for="etat-civil" class="h4">VOTRE ETAT CIVIL<span class="e">*</span></label>
<p class="text"><input type="radio" id="etat-civil" name="etat-civil" value="Madame" />Madame
<input type="radio" id="etat-civil" name="etat-civil" value="Mademoiselle" />Mademoiselle
<input type="radio" id="etat-civil" name="etat-civil" value="Monsieur" />Monsieur </p>
<table class="table1">
<tr><td><label style="padding-right: 17px;" for="nom" >Nom :<input class="input1" type="text" name="nom" size="20" maxlength="40" value="" id="nom" /></label></td></tr>
<tr><td><label style="padding-right: 17px;" for="prenom">Prénom :<input class="input1" type="text" name="prenom" size="20" maxlength="40" value="" id="prenom" /></label></tr>
<tr><td>
<label style="padding-right: 30px;" for="date-naissance">Date de naissance :
<p class="input1"><input style="width: 54px; text-align: center; color: #000;" type="text" name="date-naissance-j" size="20" maxlength="40" value="" id="Date-naissance" />
<input style="width: 54px; text-align: center; color: #000;" type="text" name="date-naissance-m" size="20" maxlength="40" value="" id="date-naissance" />
<input style="width: 54px; text-align: center; color: #000;" type="text" name="date-naissance-a" size="20" maxlength="40" value="" id="date-naissance" /></p></label></td></tr>
<tr><td><label style="padding-right: 17px;" for="lieu-naissance">Lieu de naissance :<input class="input1" type="text" name="lieu-naissance" size="20" maxlength="40" value="" id="lieu-naissance" /></label></td></tr>
<tr><td><label style="padding-right: 17px;" for="pays-naissance">Pays de naissance :<input class="input1" type="text" name="pays-naissance" size="20" maxlength="40" value="" id="pays-naissance" /></label></td></tr>
<tr><td><label style="padding-right: 17px;" for="nationalite">Nationalité :<input class="input1" type="text" name="nationalite" size="20" maxlength="40" value="" id="nationalite" /></label></td></tr>
<tr><td><label style="padding-right: 17px;" for="no-secu">N° Sécurité Sociale :<input class="input1" type="text" name="No-secu" size="20" maxlength="40" value="" id="No-secu" /></label></td></tr></table>
<p><label for="adresse-secu">Adresse de votre Centre de Sécurité Sociale :</label>
<textarea type="text"style="width: 380px;" name="adresse-secu" id="adresse-secu" cols="150" rows="2"></textarea></p>
<span class="h4">LANGUES ETRANGERES</span><span class="e">*</span><br />
<table class="table1">
<tr><td><label for="anglais">Anglais : </label></td><td><p class="text">
<input type="checkbox" id="anglais" name="anglais" value="Notions" />Notions
<input type="checkbox" id="anglais" name="anglais" value="Moyen" />Moyen
<input type="checkbox" id="anglais" name="anglais" value="Courant" />Courant
<input type="checkbox" id="anglais" name="anglais" value="Bilingue" />Bilingue </p></td></tr>
<tr><td style="texte-align: right;"><label for="allemand">Allemand : </label></td><td><p class="text">
<input type="checkbox" id="allemand" name="allemand" value="Notions" />Notions
<input type="checkbox" id="allemand" name="allemand" value="Moyen" />Moyen
<input type="checkbox" id="allemand" name="allemand" value="Courant" />Courant
<input type="checkbox" id="allemand" name="allemand" value="Bilingue" />Bilingue </p></td></tr>
<tr><td style="texte-align: right;"><label for="Espagnol">Espagnol : </label></td><td><p class="text">
<input type="checkbox" id="espagnol" name="espagnol" value="Notions" />Notions
<input type="checkbox" id="espagnol" name="espagnol" value="Moyen" />Moyen
<input type="checkbox" id="espagnol" name="espagnol" value="Courant" />Courant
<input type="checkbox" id="espagnol" name="espagnol" value="Bilingue" />Bilingue </p></td></tr>
<tr><td style="texte-align: right;"><label for="Italien">Italien : </label></td><td><p class="text">
<input type="checkbox" id="italien" name="italien" value="Notions" />Notions
<input type="checkbox" id="italien" name="italien" value="Moyen" />Moyen
<input type="checkbox" id="italien" name="italien" value="Courant" />Courant
<input type="checkbox" id="italien" name="italien" value="Bilingue" />Bilingue </p></td></tr>
<tr><td style="texte-align: right;"><label style="padding-bottom:20px" for="autre">Autre : </label></td><td><p class="text">
<input type="text" name="autre" size="20" maxlength="40" value="" id="autre" /><br />
<input type="checkbox" id="autre" name="autre" value="Notions" />Notions
<input type="checkbox" id="autre" name="autre" value="Moyen" />Moyen
<input type="checkbox" id="autre" name="autre" value="Courant" />Courant
<input type="checkbox" id="autre" name="autre" value="Bilingue" />Bilingue </p></td></tr></table><br />
<p><span class="h4">VOS MOYENS DE TRANSPORT<span class="e">*</span></span><br/>
<label for="permis">Permis de conduire : <input type="radio" name="permis" value="oui" id="oui" onClick="afficher();" />Oui
<select id="champ_cache" name="type-permis" style="width: 80px" type="text"><option>Select</option><option>A</option><option>B</option><option>C</option><option>D</option><option>E</option></select> <input type="radio" name="permis" value="non" id="non" onClick="cacher();" />Non</label></p>
<script type="text/javascript">
document.getElementById("champ_cache").style.display = "none";
function afficher()
{
document.getElementById("champ_cache").style.display = "block";
}
function cacher()
{
document.getElementById("champ_cache").style.display = "none";
}
</script>
<label for="date-permis">Date d'optention du permis :
<input type="text" name="date-permis-j" style="width: 60px; text-align: center; color: #000;" maxlength="20" value="" id="date-permis" />
<input type="text" name="date-permis-m" style="width: 60px; text-align: center; color: #000;" maxlength="20" value="" id="date-permis" />
<input type="text" name="date-permis-a" style="width: 60px; text-align: center; color: #000;" maxlength="20" value="" id="date-permis" /></label>
<label for="vehicule">Véhicule personnel :
<input type="radio" name="vehicule" value="oui" id="vehicule" /> Oui
<input type="radio" name="vehicule" value="non" id="vehicule" /> Non </label>
<label for="vehicule-autre">Autre(s) : <input type="text" name="vehicule-autre" style="width: 380px;" maxlength="90" value="" id="date-permis" /></label>
<p><span class="h4">QUELLES SONT VOS MENSURATIONS (EUROPÉENNES)</span><span class="e">*</span></p>
<table class="table1">
<tr><td style="width: 150px;"><label for="taille">Taille (hauteur en cm) : </label></td><td><input type="text" name="taille" style="width: 80px;" maxlength="20" value="" id="taille" /></td></tr>
<tr><td><label for="jupe">Taille de jupe : </label></td><td><input type="text" name="jupe" style="width: 80px;" maxlength="20" value="" id="jupe" /></td></tr>
<tr><td><label for="pantalon">Taille de pantalon : </label></td><td><input type="text" name="pantalon" style="width: 80px;" maxlength="20" value="" id="pantalon" /></td></tr>
<tr><td><label for="veste">Taille de veste : </label></td><td><input type="text" name="veste" style="width: 80px;" maxlength="20" value="" id="veste" /></td></tr>
<tr><td><label for="chaussures">Pointure de chaussure : </label></td><td><input type="text" name="chaussures" style="width: 80px;" maxlength="20" value="" id="chaussures" /></td></tr>
</table>
</div>
<div class="colonne">
<p><span class="h4">VOS COORDONNEES<span class="e">*</span></span></p>
<table class="table1">
<tr><td style="width: 180px;"><label for="adresse">Adresse : </label></td><td><input type="text" name="adresse" style="width: 300px;" maxlength="80" value="" id="adresse" /></td></tr>
<tr><td><label for="cp">Code postal : </label></td><td><input type="text" name="cp" style="width: 150px;" maxlength="5" value="" id="cp" /></td></tr>
<tr><td><label for="ville">Ville : </label></td><td><input type="text" name="ville" style="width: 300px;" maxlength="80" value="" id="ville" /></td></tr>
<tr><td><label for="tel-mobil">Téléphone portable : </label></td><td><input type="tel" name="tel-mobil" style="width: 300px;" maxlength="80" value="" id="tel-mobil" /></td></tr>
<tr><td><label for="tel-fixe">Téléphone fixe : </label></td><td><input type="tel" name="tel-fixe" style="width: 300px;" maxlength="80" value="" id="tel-fixe" /></td></tr>
<tr><td><label for="email">E-mail : </label></td><td><input type="email" name="email" style="width: 300px;" maxlength="80" value="" id="email" /></td></tr></table>
<label for="situation-familiale" class="h4">VOTRE SITUATION FAMILIALE<span class="e">*</span></label>
<p class="text">
<input type="radio" id="situation-familiale" name="situation-familiale" value="Celibataire" />Célibataire
<input type="radio" id="situation-familiale" name="situation-familiale" value="Marie" />Marié(e)
<input type="radio" id="situation-familiale" name="situation-familiale" value="En-couple" />En couple
</p>
<label for="enfants">Nombre d'enfant(s) : <input type="text" name="enfants" style="width: 50px;" maxlength="2" value="" id="enfants" /></label>
<label for="age-enfants">Âge du ou de vos enfant(s) :
<input type="text" name="age-enfant1" style="width: 50px;" maxlength="2" value="" id="age-enfants" />
<input type="text" name="age-enfant2" style="width: 50px;" maxlength="2" value="" id="age-enfants" />
<input type="text" name="age-enfant3" style="width: 50px;" maxlength="2" value="" id="age-enfants" />
<input type="text" name="age-enfant4" style="width: 50px;" maxlength="2" value="" id="age-enfants" /></label></p>
<p><span class="h4">VOTRE FORMATION</span><span class="e">*</span></p>
<label for="formation">Vous êtes étudiant(e), quel est votre niveau d'étude à ce jour ? <input type="text" name="formation" style="width: 420px;" maxlength="180" value="" id="formation" /></label>
<label class="text" for="diplomes">Diplôme(s) obtenu(s) : <input type="text" name="diplomes" style="width: 420px;" maxlength="180" value="" id="diplomes" /></label></p>
<label for="situation-actuelle" class="h4">SITUATION ACTUELLE<span class="e">*</span></label>
<p class="text">
<input type="radio" id="situation-actuelle" name="situation-actuelle" value="Etudiant" />Etudiant
<input type="radio" id="situation-actuelle" name="situation-actuelle" value="En-activite" />En activité
<input type="radio" id="situation-actuelle" name="situation-actuelle" value="Recherche-emploi" />En recherche d'emploi
</p>
<label for="experience">Quelle est votre expérience professionnelle la plus récente ? <input type="text" name="experience" style="width: 420px;" maxlength="150" value="" id="experience" /></label>
<label for="poste">Quel poste le plus récent avez-vous occupé ?<span class="e">*</span> <textarea style="width: 420px;" name="poste" id="poste" cols="150" rows="2"></textarea></label>
<label class="text" for="contrat">De quel type de contrat avez-vous bénéficié :<span class="e">*</span> </label>
<p class="text">
<input type="checkbox" id="contrat" name="contrat" value="Temps-plein" />Temps plein
<input type="checkbox" id="contrat" name="contrat" value="Temps-partiel" />Temps partiel
<input type="checkbox" id="contrat" name="contrat" value="Missions" />Missions
</p>
<label class="text" for="dpl-secouriste">Avez-vous un diplôme de secouriste ? </label>
<p class="text">
<input type="radio" id="dpl-secouriste" name="dpl-secouriste" value="oui" />Oui
<input type="radio" id="dpl-secouriste" name="dpl-secouriste" value="oui" />Non
</p>
<label for="dpl-secours">Si oui, précisez lequel : <input type="text" name="dpl-secours" style="width: 420px;" maxlength="120" value="" id="dpl-secours" /></label></p>
<p><label for="contraintes" class="h4">AVEZ-VOUS DES CONTRAINTES PERSONNELLES ?<span class="e">*</span><textarea style="width: 420px;" name="contraintes" id="contraintes" cols="150" rows="4"></textarea></label>
<label for="connu-asc" class="h4">COMMENT NOUS AVEZ-VOUS CONNU ? <textarea style="width: 420px;" name="connu-asc" id="connu-asc" cols="150" rows="4"></textarea></label>
<label for="motivation" class="h4">EN QUELQUES MOTS, CE QUI VOUS MOTIVE POUR NOUS REJOINDRE ?<span class="e">*</span><textarea style="width: 420px;" name="motivation" id="motivation" cols="150" rows="4"></textarea></label></p>
</div></div>
<div class="parent"><p style="color: #e1001a;">Les * indiquent les champs obligatoires.</p>
<p style="text-align: justify;">Ce formulaire est certifié exacte et engage votre responsabilité quant aux informations que vous nous communiquez. Conformément aux dispositions de la loi n°7817 du 06.01.1978, nous vous informons du traitement informatisé du dossier que vous avez rempli. En aucun cas ces informations ne seront transmises à un tiers sans votre accord préalable. Vous gardez le doit d’accès à ces informations ainsi que le droit de rectification ou de destruction.</p></div>
<!-- DEBUT CHARGEMENT DE FICHIERS -->
<div style="text-align: center">
<div class="picto1"><label for="cv" class="bouton">JOINDRE VOTRE CV <br/><span class="fichier">(PDF, JPG, DOC | max. 1 Mo) :</span></label>
<input type="hidden" name="MAX_FILE_SIZE" value="1048576" /><input type="file" name="cv" id="cv" /><input style="float:right; margin-right: -138px; border:none; background: transparent url(/ASC/images/suppr-bouton3.png) top left no-repeat;" type="button" value="Effacer" onclick="document.getElementById('cv').value = '';" /></div>
<div class="picto2"><label for="lettre" class="bouton">JOINDRE VOTRE LETTRE DE MOTIVATION <br /><span class="fichier">(PDF, JPG, DOC | max. 1 Mo) :</span></label>
<input type="hidden" name="MAX_FILE_SIZE" value="1048576" /><input type="file" name="lettre" id="lettre" /><input style="float:right; margin-right: -138px; border:none; background: transparent url(/ASC/images/suppr-bouton3.png) top left no-repeat;" type="button" value="Effacer" onclick="document.getElementById('lettre').value = '';" /></div>
<div class="picto3"><label for="photo" class="bouton">JOINDRE VOTRE PHOTO <br /><span class="fichier">(JPG | max. 512 Ko) :</span></label>
<input type="hidden" name="MAX_FILE_SIZE" value="524288" /><input type="file" name="photo" id="photo" /><input style="float:right; margin-right: -138px; border:none; background: transparent url(/ASC/images/suppr-bouton3.png) top left no-repeat;" type="button" value="Effacer" onclick="document.getElementById('photo').value = '';" /></div>
<div class="picto4"><input style="width: 265px; height: 24px; font-weight: 700; font-family: 'Open Sans Condensed', Arial NArrow, sans; font-size: 12pt;" type="submit" name="submit" value="ENVOYER" /></div></div>
</form> <!-- FIN FORMULAIRE -->
Script PHP :
<?php
$msg_erreur = "<br /><br /><br /><h4>Merci de remplir tous les champs repérés par le symbole *</h4> </br></br>";
$msg_ok = "<br /><br /><br /><p>Madame, Monsieur,</p><p>Nous accusons réception de votre candidature et vous remercions de l'intérêt que vous portez à notre Société.</p><p>Votre candidature est actuellement à l'étude au sein de notre service.</p><p>Sans réponse de notre part dans un délai de 15 jours, veuillez considérer que votre candidature n'est pas retenue.</p><p>Par ailleurs, sans objection de votre part, nous souhaitons conserver votre dossier pour un examen ultérieur si une opportunité correspondant à votre profil venait à se présenter.</p><p>Veuillez agréer, Madame, Monsieur, l'expression de nos salutations distinguées.</p>";
/*$message = $msg_erreur;*/
define('MAIL_DESTINATAIRE','[email protected]'); // remplacer par votre email
define('MAIL_SUJET','CANDIDATURE : '.$_POST['prenom'].' '.$_POST['nom'].'');
// vérification des champs
if (empty($_POST['email']))
$message .= "Merci de nous fournir une adresse e-mail valide.<br/>";
// si un champ est vide, on affiche le message d'erreur et on stoppe le script
if (empty($_POST['prestation'])
or empty($_POST['etat-civil'])
or empty($_POST['prenom'])
or empty($_POST['nom'])
or empty($_POST['lieu-naissance'])
or empty($_POST['pays-naissance'])
or empty($_POST['nationalite'])
or empty($_POST['permis'])
or empty($_POST['vehicule'])
or empty($_POST['adresse'])
or empty($_POST['cp'])
or empty($_POST['ville'])
or empty($_POST['email'])
or empty($_POST['situation-familiale'])
or empty($_POST['formation'])
or empty($_POST['diplomes'])
or empty($_POST['situation-actuelle'])
or empty($_POST['experience'])
or empty($_POST['contraintes'])
or empty($_POST['motivation'])) {
echo $msg_erreur;;
echo'<form>
<h1><input type="button" value="Retour" onclick="history.go(-1)"></h1>
</form>';
}else{
//Préparation de l'entête du mail:
$mail_entete = "MIME-Version: 1.0rn";
$mail_entete .= "From: {$_POST['mail']} ";
$mail_entete .= 'Reply-To: '.$_POST['email']."rn";
$mail_entete .= 'Content-Type: text/plain; charset="UTF8"';
$mail_entete .= "rnContent-Transfer-Encoding: 8bitrn";
$mail_entete .= 'X-Mailer:PHP/' . phpversion()."rn";
// préparation du corps du mail
$mail_corps = "Message provenant de la page NOUS REJOINDRE du site ASC
";
$mail_corps .= "
";
$mail_corps .= "PRESTATION : {$_POST['prestation']}
";
$mail_corps .= "---------------------------------------------------------------------------
";
$mail_corps .= "Contrat recherché : {$_POST['cdi']}{$_POST['cdd']}{$_POST['tplein']}{$_POST['tpartiel']}{$_POST['missions']}
";
$mail_corps .= "Disponibilités : {$_POST['semaine']}{$_POST['jour']}{$_POST['soir']}{$_POST['nuit']}{$_POST['we']}
";
$mail_corps .= "Jours : {$_POST['lun']}{$_POST['mar']}{$_POST['mer']}{$_POST['jeu']}{$_POST['ven']}{$_POST['sam']}{$_POST['dim']}
";
$mail_corps .= "A partir du : {$_POST['dispo']}
";
$mail_corps .= "
";
$mail_corps .= "
";
$mail_corps .= "LE CANDIDAT - LA CANDIDATE : {$_POST['etat-civil']} {$_POST['prenom']} {$_POST['nom']}
";
$mail_corps .= "---------------------------------------------------------------------------
";
$mail_corps .= "
";
$mail_corps .= "{$_POST['adresse']} - {$_POST['cp']} {$_POST['ville']}
";
$mail_corps .= "{$_POST['tel-mobile']} {$_POST['tel-fixe']} {$_POST['email']}
";
$mail_corps .= "Né le {$_POST['date-naissance-j']} {$_POST['date-naissance-m']} {$_POST['date-naissance-a']} à {$_POST['lieu-naissance']}
";
$mail_corps .= "
";
$mail_corps .= "Pays de naissance : {$_POST['pays-naissance']}
";
$mail_corps .= "Nationalité : {$_POST['nationalite']}
";
$mail_corps .= "
";
$mail_corps .= "N° de sécurité social : {$_POST['so-secu']}
";
$mail_corps .= "Adresse de centre : {$_POST['adresse-secu']}
";
$mail_corps .= "
";
$mail_corps .= "
";
$mail_corps .= "FORMATION - EXPERIENCE :
";
$mail_corps .= "---------------------------------------------------------------------------
";
$mail_corps .= "Niveau d'étude : {$_POST['formation']}
";
$mail_corps .= "Diplôme(s) : {$_POST['diplomes']}
";
$mail_corps .= "Situation actuelle : {$_POST['situation-actuelle']}
";
$mail_corps .= "Expérience professionnelle récente : {$_POST['experience']}
";
$mail_corps .= "Poste le plus récent : {$_POST['poste']}
";
$mail_corps .= "Type de contrat : {$_POST['contrat']}
";
$mail_corps .= "Diplome de secouriste : {$_POST['dpl-secours']}
";
$mail_corps .= "
";
$mail_corps .= "
";
$mail_corps .= "CONTRAINTES :
";
$mail_corps .= " {$_POST['contraintes']}
";
$mail_corps .= "
";
$mail_corps .= "COMMENT AVEZ-VOUS CONNU ASC ? :
";
$mail_corps .= " {$_POST['connu-asc']}
";
$mail_corps .= "
";
$mail_corps .= "MOTIVATION :
";
$mail_corps .= " {$_POST['motivation']}
";
$mail_corps .= "
";
$mail_corps .= "
";
$mail_corps .= "LANGUES ETRANGERES :
";
$mail_corps .= "---------------------------------------------------------------------------
";
$mail_corps .= "Anglais : {$_POST['anglais']}
";
$mail_corps .= "Allemand : {$_POST['allemand']}
";
$mail_corps .= "Espagnol : {$_POST['espagnol']}
";
$mail_corps .= "Italien : {$_POST['italien']}
";
$mail_corps .= "{$_POST['autre']} : {$_POST['autre']}
";
$mail_corps .= "
";
$mail_corps .= "
";
$mail_corps .= "MOYENS DE TRANSPORT :
";
$mail_corps .= "---------------------------------------------------------------------------
";
$mail_corps .= "Permis : {$_POST['permis']} - Type {$_POST['type-permis']}
";
$mail_corps .= "Date d'obtention : {$_POST['date-permis-j']} {$_POST['date-permis-m']} {$_POST['date-permis-a']}
";
$mail_corps .= "Véhicule personnel : {$_POST['vehicule']} {$_POST['autre-vehicule']}
";
$mail_corps .= "
";
$mail_corps .= "
";
$mail_corps .= "MENSURATIONS EUROPENNES :
";
$mail_corps .= "---------------------------------------------------------------------------
";
$mail_corps .= "Taille : {$_POST['taille']}
";
$mail_corps .= "Jupe : {$_POST['jupe']}
";
$mail_corps .= "Pantalon : {$_POST['pantalon']}
";
$mail_corps .= "Veste : {$_POST['veste']}
";
$mail_corps .= "Pointure : {$_POST['chaussures']}
";
$mail_corps .= "
";
$mail->AddAttachment('uload/*.*');
// envoi du mail
if (mail(MAIL_DESTINATAIRE,MAIL_SUJET,$mail_corps,$mail_entete)) {
//Le mail est bien expédié
echo $msg_ok;
echo'</br></br>';
echo'<form>
<input type="button" value="Retour" onclick="history.go(-1)">
</form>';
} else {
//Le mail n'a pas été expédié
echo "Une erreur est survenue lors de l'envoi du formulaire par email";
}
}
?>
Ca marche mais pour le moment je ne me suis pas occupé de l'upload et l'envoi des 3 fichiers : CV, lettre, photo.Le formulaire est visible ici : http://eikona.fr/ASC/espace-emploi/nous-rejoindre.html
J'ai lu beaucoup de chose mais je ne suis pas capable d'adapter dans mon cas.
La plupart des tutoriels ne parlent que de l'upload. Mais déjà ça je n'ai pas réussi à le faire...
Désolé. Merci de bien vouloir m'aiguiller un peu.