Hulp gevraagd voor het verzenden van een form

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Pagina: 1 2 volgende »

Fouad El Amrani

Fouad El Amrani

15/02/2012 12:46:02
Quote Anchor link
Hallo,
Ik heb een form gemaakt in html met daarachter de php script. De bedoeling is dat ik deze in mijn mailbox krijg.Ik heb een beetje van alles geprobeerd en krijg het niet goed.de form wordt niet verzonden.Kan mij aub iemand mij hiermee helpen.
Hieronder vind u de code

HTML:
<html>
<head>
</head>
<body>
<fieldset><legend>Sollicitatie</span></legend>

<!--begin:notice message block-->

<div id="note"></div>
<!--begin:notice message block-->

<form id="ajax-contact-form" method="post" ENCTYPE="multipart/form-data" action="index.php" action="javascript:alert('success!');">
<center><p><font color="red">* required fields</font></p></center>
<label>Function</label>
<select name="Function">
<option value="Worker">Worker</option>
<option value="Handy Man">Handy Man</option>
<option value="Cleaning lady/Cleaner">Cleaning lady/Cleaner</option>
<option value="Site leader for renovation works">Site leader for renovation works</option>
<option value="Administrative employee">Administrative employee</option>
<option value="Crane driver">Crane driver</option>
<option value="Room maids">Room maids</option>
<option value="Sales Representatives">Sales Representatives</option>
</select><br />

<label>Name <font color="red">*</font></label><input class="required inpt" type="text" name="name" value="" /><br />
<input type="radio" name="sex" value="male" /> Male<br />
<input type="radio" name="sex" value="female" /> Female<br />


<label>Address</label><font color="red">*</font><input type="text" name="Address" value="" /><br />
<label>Code Postal<font color="red">*</font></label><input class="required inpt" type="text" name="Code Postal" value="" /><br />
<label>City<font color="red">*</font></label><input class="required inpt" type="text" name="city" value="" /><br />
<label>Phone <font color="red">*</font></label><input class="required inpt" type="text" name="phone" value="" /><br />
<label>E-Mail<font color="red">*</font></label><input class="required inpt" type="text" name="email" value="" /><br />
<label>Driving license</label><font color="red">*</font><input class="required input type="text" name="Driving license" value="" /><br />
<label>Experiance</label><input class="required input type="text" name="Experiance" value="" /><br />
<label>Nationality</label><font color="red">*</font><input class="required input type="text" name="Nationality" value="" /><br />
<label>Languages</label><font color="red">*</font><input class="required input type="text" name="Languages" value="" /><br />




Curriculum Vitae <INPUT TYPE=FILE NAME="upfile"><BR>
<INPUT TYPE=SUBMIT VALUE="Submit">


</form>
</body>
</html>

PHP
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php



// Receiving variables
@$Function = addslashes($_POST['Function']);
@
$name = addslashes($_POST['name']);
@
$sex = addslashes($_POST['sex']);
@
$Address = addslashes($_POST['Address']);
@
$Code_Postal = addslashes($_POST['Code_Postal']);
@
$city = addslashes($_POST['city']);
@
$phone = addslashes($_POST['phone']);
@
$email = addslashes($_POST['email']);
@
$Driving_license = addslashes($_POST['Driving_license']);
@
$Experiance = addslashes($_POST['Experiance']);
@
$Nationality = addslashes($_POST['Nationality']);
@
$Languages = addslashes($_POST['Languages']);
@
$upfile_Name = $_FILES['upfile']['name'];
@
$upfile_Size = $_FILES['upfile']['size'];
@
$upfile_Temp = $_FILES['upfile']['tmp_name'];
@
$upfile_Mime_Type = $_FILES['upfile']['type'];

function
RecursiveMkdir($path)
 {

   if (!file_exists($path))
   {

      RecursiveMkdir(dirname($path));
      mkdir($path, 0777);
    }
  }



// Validation
if ( strcasecmp($sex,"male") != 0 && strcasecmp($sex,"female") != 0 )
{

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid sex</font></p>");
}



if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>");
}


if( $upfile_Size == 0)
{

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid upfile</font></p>");
}

if( $upfile_Size >50000000)
{

//delete file
unlink($upfile_Temp);
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid upfile</font></p>");
}

if( $upfile_Mime_Type != "image/gif" AND $upfile_Mime_Type != "image/pjpeg" AND $upfile_Mime_Type != "image/jpeg" AND $upfile_Mime_Type != "image/png" AND $upfile_Mime_Type != "image/tiff" AND $upfile_Mime_Type != "text/" )
{

unlink($upfile_Temp);
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid upfile</font></p>");
}

$uploadFile =  $upfile_Name ;
if (!is_dir(dirname($uploadFile)))
  {
    @
RecursiveMkdir(dirname($uploadFile));
  }

else
  {
  @
chmod(dirname($uploadFile), 0777);
  }
@
move_uploaded_file( $upfile_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upfile_URL = "http://www.orisma.com.tr/uplfile/".$upfile_Name ;

//Sending Email to form owner
$pfw_header = "From: $email\n"
  . "Reply-To: $email\n";
$pfw_subject = "Curriculum Vitae";
$pfw_email_to = "[email protected]";
$pfw_message = "Function: $Function\n"
. "name: $name\n"
. "sex: $sex\n"
. "Address: $Address\n"
. "Code_Postal: $Code_Postal\n"
. "city: $city\n"
. "phone: $phone\n"
. "email: $email\n"
. "Driving_license: $Driving_license\n"
. "Experiance: $Experiance\n"
. "Nationality: $Nationality\n"
. "Languages: $Languages\n"
. "upfile: $upfile_URL\n";
@
mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

 echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>Thank you, we have received your message</font></p>");
?>
 
PHP hulp

PHP hulp

25/11/2024 05:06:07
 
- SanThe -

- SanThe -

15/02/2012 12:49:44
Quote Anchor link
action="index.php" action="javascript:alert('success!');"

Tja en welke moet ie nou hebben? Er kan maar één action zijn.
 
Jacco Engel

Jacco Engel

15/02/2012 12:50:12
Quote Anchor link
Laten we eens beginnen met een basic vraag :)

Draait er wel een mailserver op de server waar je vanaf wil mailen :)?

Verder zijn dit je 2 nieuwe beste vrienden :
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
ini_set("display_errors" , 1) ;
error_reporting(E_ALL);


edit 2:
Als je een @ voor je mailfunctie zet is 1 ding zeker. Je zal nooit zien wat er mis gaat :)
Gewijzigd op 15/02/2012 12:52:09 door Jacco Engel
 
- SanThe -

- SanThe -

15/02/2012 12:53:33
 
Fouad El Amrani

Fouad El Amrani

15/02/2012 12:54:18
Quote Anchor link
Op vraag van santhe index.php en er draait een mailserver. ik heb een ook en contact form aangemaakt en die werkt wel.
Maar ik dacht dat ik misschien wel een fout heb zitten in mijn php
 
- SanThe -

- SanThe -

15/02/2012 12:54:42
Quote Anchor link
ereg() is antiek. Niet meer gebruiken dus.

Toevoeging op 15/02/2012 12:56:36:

Haal al die @-jes weg.

Zet error reporting aan.

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);

// rest
?>
 
Fouad El Amrani

Fouad El Amrani

15/02/2012 13:00:05
Quote Anchor link
en wat moet ik dan in de plaats gaan gebruiken van ereg?
 
Reshad F

Reshad F

15/02/2012 13:02:03
Quote Anchor link
preg_match :)
 
- SanThe -

- SanThe -

15/02/2012 13:03:29
Quote Anchor link
Fouad El Amrani op 15/02/2012 13:00:05:
en wat moet ik dan in de plaats gaan gebruiken van ereg?


Op php.net kijken.

Van php.net:

Note:

preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg().
 
Fouad El Amrani

Fouad El Amrani

15/02/2012 13:14:12
Quote Anchor link
sorry voor de volgende vraag :), ik ben dan ok maar een leek in php.
is het dan juist voldoende om ereg te vervangen door preg_match() of moet heel de regel aangepast worden?
 
Jacco Engel

Jacco Engel

15/02/2012 13:15:15
Quote Anchor link
- SanThe - op 15/02/2012 13:03:29:
Fouad El Amrani op 15/02/2012 13:00:05:
en wat moet ik dan in de plaats gaan gebruiken van ereg?


Op php.net kijken.
 
Obelix Idefix

Obelix Idefix

15/02/2012 13:18:13
Quote Anchor link
Kijk op php.net voor uitleg.
 
Fouad El Amrani

Fouad El Amrani

15/02/2012 19:58:13
Quote Anchor link
heb op php.net gekeken en heb geen antwoord op mijn vraag,het zou wel aan mij liggen :-) maar kunnen jullie mij aub verder helpen.
 
Reshad F

Reshad F

15/02/2012 20:15:22
Quote Anchor link
nou zet preg_match in je code en kijk of je een foutmelding krijgt?
Gewijzigd op 15/02/2012 20:15:49 door Reshad F
 
Fouad El Amrani

Fouad El Amrani

15/02/2012 20:41:14
Quote Anchor link
alvast bedankt farid maar heb de volgende foutmelding gekregen

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
 
Tim van Norde

Tim van Norde

15/02/2012 20:48:20
Quote Anchor link
Ik gok ook dat je webhost up-2-date is wat zou betekenen dat ereg helemaal niet zou werken, aangezien de functie verwijderd is sinds PHP 5.3.0.
Normaal zou PHP dan iets zeggen van 'Function ereg is deprecated blabla' wat dus nu niet gebeurt.

Zet je error reporting aan, haal de @jes weg want die zorgen er juist voor dat de error die mogelijk wordt gegenereerd genegeerd wordt (Dat wist je misschien al). Bekijk het resultaat en drop het hier :)
 
Fouad El Amrani

Fouad El Amrani

16/02/2012 12:31:32
Quote Anchor link
de error is na de aanpassing die ik aangebracht heb zoals men mij hier op de forum heeft gezegd.
de code ziet er nu als volgt uit:


<fieldset><legend>[email protected]</span></legend>

<!--begin:notice message block-->

<div id="note"></div>
<!--begin:notice message block-->

<form id="ajax-contact-form" method="post" ENCTYPE="multipart/form-data" action="index.php" >
<center><p><font color="red">* required fields</font></p></center>
<label>Function</label>
<select name="Function">
<option value="Worker">Worker</option>
<option value="Handy Man">Handy Man</option>
<option value="Cleaning lady/Cleaner">Cleaning lady/Cleaner</option>
<option value="Site leader for renovation works">Site leader for renovation works</option>
<option value="Administrative employee">Administrative employee</option>
<option value="Crane driver">Crane driver</option>
<option value="Room maids">Room maids</option>
<option value="Sales Representatives">Sales Representatives</option>
</select><br />

<label>Name <font color="red">*</font></label><input class="required inpt" type="text" name="name" value="" /><br />
<input type="radio" name="sex" value="male" /> Male<br />
<input type="radio" name="sex" value="female" /> Female<br />


<label>Address</label><font color="red">*</font><input type="text" name="Address" value="" /><br />
<label>Code Postal<font color="red">*</font></label><input class="required inpt" type="text" name="Code Postal" value="" /><br />
<label>City<font color="red">*</font></label><input class="required inpt" type="text" name="city" value="" /><br />
<label>Phone <font color="red">*</font></label><input class="required inpt" type="text" name="phone" value="" /><br />
<label>E-Mail<font color="red">*</font></label><input class="required inpt" type="text" name="email" value="" /><br />
<label>Driving license</label><font color="red">*</font><input class="required input type="text" name="Driving license" value="" /><br />
<label>Experiance</label><input class="required input type="text" name="Experiance" value="" /><br />
<label>Nationality</label><font color="red">*</font><input class="required input type="text" name="Nationality" value="" /><br />
<label>Languages</label><font color="red">*</font><input class="required input type="text" name="Languages" value="" /><br />




Curriculum Vitae <INPUT TYPE=FILE NAME="upfile"><BR>
<INPUT TYPE=SUBMIT VALUE="Submit">


</form>




Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php

ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);

// rest

// Receiving variables

$Function = addslashes($_POST['Function']);
$name = addslashes($_POST['name']);
$sex = addslashes($_POST['sex']);
$Address = addslashes($_POST['Address']);
$Code_Postal = addslashes($_POST['Code_Postal']);
$city = addslashes($_POST['city']);
$phone = addslashes($_POST['phone']);
$email = addslashes($_POST['email']);
$Driving_license = addslashes($_POST['Driving_license']);
$Experiance = addslashes($_POST['Experiance']);
$Nationality = addslashes($_POST['Nationality']);
$Languages = addslashes($_POST['Languages']);
$upfile_Name = $_FILES['upfile']['name'];
$upfile_Size = $_FILES['upfile']['size'];
$upfile_Temp = $_FILES['upfile']['tmp_name'];
$upfile_Mime_Type = $_FILES['upfile']['type'];

function
RecursiveMkdir($path)
 {

   if (!file_exists($path))
   {

      RecursiveMkdir(dirname($path));
      mkdir($path, 0777);
    }
  }



// Validation
if ( strcasecmp($sex,"male") != 0 && strcasecmp($sex,"female") != 0 )
{

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid sex</font></p>");
}



if (! preg_match('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>");
}


if( $upfile_Size == 0)
{

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid upfile</font></p>");
}

if( $upfile_Size >50000000)
{

//delete file
unlink($upfile_Temp);
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid upfile</font></p>");
}

if( $upfile_Mime_Type != "image/gif" AND $upfile_Mime_Type != "image/pjpeg" AND $upfile_Mime_Type != "image/jpeg" AND $upfile_Mime_Type != "image/png" AND $upfile_Mime_Type != "image/tiff" AND $upfile_Mime_Type != "text/" )
{

unlink($upfile_Temp);
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid upfile</font></p>");
}

$uploadFile =  $upfile_Name ;
if (!is_dir(dirname($uploadFile)))
  {
    @
RecursiveMkdir(dirname($uploadFile));
  }

else
  {
  @
chmod(dirname($uploadFile), 0777);
  }
@
move_uploaded_file( $upfile_Temp , $uploadFile);
chmod($uploadFile, 0644);
$upfile_URL = "http://www.orisma.com.tr/uplfile/".$upfile_Name ;

//Sending Email to form owner
$pfw_header = "From: $email\n"
  . "Reply-To: $email\n";
$pfw_subject = "Curriculum Vitae";
$pfw_email_to = "[email protected]";
$pfw_message = "Function: $Function\n"
. "name: $name\n"
. "sex: $sex\n"
. "Address: $Address\n"
. "Code_Postal: $Code_Postal\n"
. "city: $city\n"
. "phone: $phone\n"
. "email: $email\n"
. "Driving_license: $Driving_license\n"
. "Experiance: $Experiance\n"
. "Nationality: $Nationality\n"
. "Languages: $Languages\n"
. "upfile: $upfile_URL\n";
@
mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

 echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>Thank you, we have received your message</font></p>");
?>
 
Tim van Norde

Tim van Norde

16/02/2012 13:26:31
Quote Anchor link
Heel mooi, maar wat kwam er uit?
 
Reshad F

Reshad F

16/02/2012 13:30:09
Quote Anchor link
wat heb je voor foutmeldingen? Post die hier even :)
 
Fouad El Amrani

Fouad El Amrani

16/02/2012 18:20:54
Quote Anchor link
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
 
Reshad F

Reshad F

16/02/2012 18:30:24
Quote Anchor link
en dit gebeurt alleen met preg_match ? en als je ereg erin hebt dan doet hij het wel of krijg je dit dan nog steeds? want een 404 error krijg je meestal als iets niet wordt gevondenn ...
 

Pagina: 1 2 volgende »



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.