#1  
Old 9th October 2006, 04:32
Lightingbolt Lightingbolt is offline
Junior Member
 
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb need help on Contact Page

afternoon all

I'm setting up a contact page using this php script, would like to add a coutry dropdown list all an ip tracker where my clients are coming from

can someone help us as i'm having problems putting it together.....

PHP Code:
<hmtl>
<head>
<title>Cuntact Us.</title>
</head>

<body>
<form action="http://www.cyberdating.com.au/mailthanks.php" method="post">
Name: <input type="text" name="name"><br>
E-mail Address: <input type="text" name = "email"><br>
Phone Number: <input type="text" name="name"><br>
Subject:<input type="text" name="Subject"><br>
Topic:<textarea name="comments"></textarea><br>
<input type="RADIO" name="Website" value="cyberdating"<br><br>Cyberdating</br>
<input type="submit" value="Submit">
</form>
<?
function checkOK($field)
{
if (
eregi("\r",$field) || eregi("\n",$field)){
die(
"Invalid Input!");
}
$name=$_POST['name'];
checkOK($name);
$email=$_POST['email'];
checkOK($email);
$Phone number=$_POST['phone number'];
checkOK($phonenumber);
$country =$ROW['country'];
$comments=$_POST['comments'];
checkOK($comments);
$to="feeback@cyberdating.com.au";
$message="$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address was: $email";
if(
mail($to,"Comments From Your Site",$message,"From: $email\n")) {
echo 
"Thankyou for choosing Cyberdating one of our Sales Representatives 
will contact you shortly, If you have any furtre questions 
please do not hessite to contact us."
;
} else {
echo 
"There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>
</body>
</html>
Reply With Quote
Sponsored Links
  #2  
Old 9th October 2006, 07:11
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
Default

So you want a country dropdownlist, as well as hidden infos from an IP tracker?

Well the first part is quite easy. Either you define your drowdown in the html stuff, or you define an array in the php code from which you generate the dropdown then. At the end you can use that array to verify the input, but you should add an extra field for countries you did no list:

e.g.
PHP Code:

<?php
$countries 
= array( 'yourinternalcountryname' => 'Countrnametheusersees' );
?>

<html>
...

<!-- Generate pulldown -->
<select size="1" name="country">
 <option value="">Select your country</option>
 <?php
   
while( list($k,$v) = each($countries) ) {
          echo 
"<option value=\"$k\">$v</option>\n";
   }
 
?>
</select>

...


<?php
  
/*** The "verifycode" ***/
  
if( !array_key_exists($_POST['country'], $countries) ) {
        
//Your errormessage here
  
}
?>

The Clients IP thing you can read from the superglobal array $_SERVER.
Don't know the element by now but just take a look at its structure, e.g. with the following code...
PHP Code:
<?php

echo '<pre>';
var_dump($_SERVER);
echo </
pre>;

?>
Reply With Quote
  #3  
Old 9th October 2006, 11:02
Lightingbolt Lightingbolt is offline
Junior Member
 
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

with that php script, where do i put that in my code i'm quite lost..

Mike
Reply With Quote
  #4  
Old 9th October 2006, 11:53
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
Default

It is nearly the structure I postet....

the first part comes on the top, the pulldown stuff anywhere in your htmlform

and the last thing shall be put where you check your values....
Reply With Quote
  #5  
Old 9th October 2006, 12:31
Lightingbolt Lightingbolt is offline
Junior Member
 
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not sure if i have done this right just quote me here also notiuce with the radio buttons seams to be checked.

PHP Code:
<hmtl>
<head>
<title>Cuntact Us.</title>
</head>

<body>
<form action="http://www.cyberdating.com.au/mailthanks.php" method="post">
Name: <input type="text" name="name"><br>
E-mail Address: <input type="text" name = "email"><br>
Phone Number: <input type="text" name="name"><br>
<select size="1" name="country"><option value="">-----Select your country-------</option> 
Subject: <input type="text" name="Subject"><br>
Topic:<textarea name="comments"></textarea><br>
<input type="RADIO" name="Website" value="cyberdating"<br><br>Cyberdating</br>
<input type="RADIO" name="Mailing list" value="cyberdating Mailing List"<br><br>Cyberdating Mailing List</br>
<input type="submit" value="Submit">
</form>
<?
function checkOK($field)
{
if (
eregi("\r",$field) || eregi("\n",$field)){
die(
"Invalid Input!");
}
$name=$_POST['name'];
checkOK($name);
$email=$_POST['email'];
checkOK($email);
$Phone number=$_POST['phone number'];
checkOK($phonenumber);
$country =$ROW['country'];
$comments=$_POST['comments'];
checkOK($comments);
$to="feeback@cyberdating.com.au";
$message="$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address was: $email";
if(
mail($to,"Comments From Your Site",$message,"From: $email\n")) {
echo 
"Thankyou for choosing Cyberdating one of our Sales Representatives 
will contact you shortly, If you have any furtre questions 
please do not hessite to contact us."
;
} else {
echo 
"There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>
</body>
</html>
Reply With Quote
  #6  
Old 9th October 2006, 12:39
Ben Ben is offline
Moderator
 
Join Date: Jul 2006
Posts: 1,029
Thanks: 7
Thanked 62 Times in 56 Posts
Default

No you for got the whole rest.

Definition of countries in the top, the php code with while to generate the selectbox as well as the synataxcheck....
Reply With Quote
  #7  
Old 9th October 2006, 13:52
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,146
Thanks: 4
Thanked 55 Times in 51 Posts
 
Default

The remote ip address is:

$ip = $_SERVER["REMOTE_ADDR"];

and for verifiying the email address you chould use the check_email_mx function from this thise:

http://www.planet-source-code.com/vb...=1316&lngWId=8
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Default Holding Page mphayesuk General 13 7th July 2007 16:25
The page cannot be displayed on Port: 81 nysprite Installation/Configuration 1 21st June 2006 11:42
Frequent blank page when first opening site? minezamac Installation/Configuration 3 1st May 2006 19:55
PHP > MYSQL to protect a page mphayesuk Programming/Scripts 5 6th April 2006 23:15
Accessing the ISPConfig Web Page nformosa Installation/Configuration 1 9th September 2005 14:13


All times are GMT +2. The time now is 02:32.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.