Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

problem in php contact form process



5:24 pm on May 1, 2007 (gmt 0)

10+ Year Member

I want a simple php form process script which I can use in html form page. Yesterday, I have found simple php form script. It is the exact script which I was looking (form process via php file and form in html page).

I have done some customization in input tags, added website and country tag.

File - process.php
$name = stripslashes($name);
$email = stripslashes($email);
$country = stripslashes($country);
$website = stripslashes($website);
$message = stripslashes($message);
mail('name@example.com',$country,$website,$message,"From: $name <$email>");

File - contact.html
<form action="process.php" method="post" onsubmit="return checkform (this);">
Your Name: <br><input name="name" size="30" maxlength="50" value="" type="text" class="forminput"> (required)<br><br>
Your Email: <br><input name="email" size="30" maxlength="50" value="" type="text" class="forminput"> (required)<br><br>
Your Country: <br><SELECT NAME="country" class="forminput">
<OPTION VALUE="">Choose Country</OPTION>
<OPTION VALUE="Afghanistan">Afghanistan</OPTION>
<OPTION VALUE="Albania">Albania</OPTION>
<OPTION VALUE="Algeria">Algeria</OPTION>
<OPTION VALUE="American Samoa">American Samoa</OPTION>
<OPTION VALUE="Andorra">Andorra</OPTION>
<OPTION VALUE="Angola">Angola</OPTION>
<OPTION VALUE="Anguilla">Anguilla</OPTION>
<OPTION VALUE="Antarctica">Antarctica</OPTION>
<OPTION VALUE="Antigua And Barbuda">Antigua And Barbuda</OPTION>
<OPTION VALUE="Argentina">Argentina</OPTION>
<OPTION VALUE="Zimbabwe">Zimbabwe</OPTION></SELECT> (required)<br><br>
Your Website: <br><input name="website" size="30" maxlength="100" value="" type="text" class="forminput"><br><br>
Your Message: <br><textarea name="message" cols="25" rows="6" class="forminput"></textarea><br><br>
<input name="Submit" value="Send" type="submit">

My problem when I process this form via process.php file, request has sent to email ID but only email address and name I got in email. Rest of the information I didn't get e.g. country, website, message.

I don't know much about programing ;)

Please help!


[edited by: eelixduppy at 7:00 pm (utc) on May 1, 2007]
[edit reason] example.com [/edit]


12:32 am on May 2, 2007 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member


The problem is in your concatenation syntax. Try this:

mail('name@example.com',$country.' '.$website,$message,"From: $name <$email>");

Notice how I used periods instead of commas. I also added a space in there

NOTE-Your code is insecure and can lead to email header injections. Having uncleaned user-define variables in the additional headers is bad. Read up on this! [securephpwiki.com...]


Featured Threads

Hot Threads This Week

Hot Threads This Month