homepage Welcome to WebmasterWorld Guest from 54.81.170.186
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
problem in php contact form process
Manpasand




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

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
-----------
<?php
@extract($_POST);
$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>");
header("location:thanks.html");
?>
------------

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">
</form>
------------

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!

Thanks

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

 

eelixduppy




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

Hello,

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...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved