Contact Us 2.0. - php Form

Author Topic: Contact Us 2.0.  (Read 27848 times)

Offline boyfrom75

  • VIP
  • ****
  • Posts: 27
  • Karma: +5/-0
    • View Profile
Re: Contact Us 2.0. HTML
« Reply #30 on: September 03, 2011, 10:44:22 PM »
How do I put lots of codes in here..?

I always get a error..  :(

I can not insert more that 4000 characters

The following error or errors occurred while Im posting a long message

The message exceeds the maximum allowed length (4000 characters).


Offline boyfrom75

  • VIP
  • ****
  • Posts: 27
  • Karma: +5/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #31 on: September 03, 2011, 11:03:28 PM »
I can get this contact page in my website to work... :-[

I spend hours and I cant see were is the error... :-[

I added more options to  Contact Us script , but that is not the problem because the script that I made the changes work perfect when Im using the original design  ( contact.php)

But I can get to work in the HTML page..

Im using the redesign from the post made by JANOS .. The code made by him works perfect on the server,, But it dosen't work in my page :-[

This is the website page

http://laundryservice.me/index-7.html

This is my contact.php  file

Code: [Select]
<?php
$email 
'someone@gmail.com';
$jname $_POST['jname'];
$jemail $_POST['jemail'];
$jphone $_POST['jphone'];
$jcity $_POST['jcity'];
$jfeed $_POST['jfeed'];
$time date ("h:i A"); 
$date date ("l, F jS, Y");
$urlh getenv(HTTP_HOST);
$url "http://$urlh";
$ip $_SERVER['REMOTE_ADDR'];
$headers 'From: System Admin';
$subject "You have a new Laundry Request for Pick Up";
$body $_POST['body'];
$bodys "Message:\n$jfeed\n\n
Contact Us Form\n\n$date at $time.\n\n
IP Address.$ip \n\n
E Address: $jemail\n\n
Name: $jname \n\n
Url: $url\n\n 
Phone: $jphone \n\n
City: $jcity \n\n"
;
$name=array($jname,$jemail,$jphone,$jcity,$jfeed);
foreach (
$name as $name
{
if (
ereg("^\.",$name)) {
echo 
"<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>";  
 Die();
}
if (
ereg("\<"$name)) {
echo 
"<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>";  
 Die();
}
if (
ereg("\["$name)) {
echo 
"<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>";  
 Die();
}
if (
ereg("\`"$name)) {
echo 
"<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>";  
 Die();
}
if (
strlen($name) > 250) {
echo 
"<center><div id=\"formes\">The field cannot contain more than 150 characters:
<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>"
;  
 Die();
}
if (
strlen($name) < 4) {
echo 
"<center><div id=\"formes\">Min 4 characters:
<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>"
;  
 Die();
}
}
$body $body $bodys;
mail($email$subject$body"From: $email");
echo 
"<center><div id=\"formes\">We have successfully received your request! Someone will get in touch with you to coordinate a pick-up time and details. </div></center>";  
?>



Offline janos

  • Contributor
  • *****
  • Posts: 53
  • Karma: +4/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #32 on: September 04, 2011, 12:52:40 AM »
Replace this code:

Code: [Select]
<form name=ccform id="formes" action="<?php echo $PHP_SELF?>" method="post" onSubmit="return checkEmail(this)">
with:

Code: [Select]
<form name=ccform id="formes" action="contact.php" method="post" onSubmit="return checkEmail(this)">

Offline boyfrom75

  • VIP
  • ****
  • Posts: 27
  • Karma: +5/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #33 on: September 04, 2011, 01:47:31 PM »
Thank You JANOS...!  You are a genius...

Im so stupid... :-\  I know the page wasn't calling the external contact.php script .. But I just couldn't find out were was the error..

Thanks a lot for your help... I hope my HTML page don't have any more errors... This is the most important page in my website ..  I need this page to be working %100.

Im a little worry because the " Submit Button " is not moving when someone clicks with the mouse ( Firefox ) And don't even looks like a button.

I wish I can use a image.gif  button with a click animation, So when peoples click they can see that the button was pressed and they can wait for the confirmation.

Like this It looks like the button was never clicked..  :(

Offline janos

  • Contributor
  • *****
  • Posts: 53
  • Karma: +4/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #34 on: September 04, 2011, 03:31:21 PM »
Perhaps you can try with this css...

Code: [Select]
#sbutton:active {
             width:82px;
             height:25px;
             border:1px solid #ddd;
             display:block;
              background-image: url(images/button.png);
              background-repeat: no-repeat;
              font-family:"trebuchet ms";
              font-size:13px;
              color:#111;
             
}

 :)

Offline boyfrom75

  • VIP
  • ****
  • Posts: 27
  • Karma: +5/-0
    • View Profile
Someone knows how to add a "drop down menu" to this form?
« Reply #35 on: December 18, 2011, 09:53:04 PM »
It will be interested to add another line but with a drop down menu to the same contact form..

Im using this form and I like it,,!  but Im having a problem because I have added a address, state and phone number to this form. But sometimes peoples dont put the town were they are located, I offer my service  to 3 different towns and I have to call them sometimes because they dont provide the full location..

If I have a drop down menu with 4 option, so the user can choose or click one of the options, it will be a big help in my website..

Plus a lot of us can use the drop down menu for other applications..

Is there someone here that knows how to do it...?

Offline alex

  • Global Moderator
  • *****
  • Posts: 77
  • Karma: +20/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #36 on: December 19, 2011, 01:10:39 AM »
hi @boyfrom75

Code: [Select]
<?php $email 'info@example.com'?>
<head>
<SCRIPT LANGUAGE="JavaScript">
function checkEmail(ccForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(ccForm.jemail.value)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}
//  End -->
</script>
<script type="text/javascript">
function make_blank()
{
document.ccform.jname.value ="";
}
</script>
<script type="text/javascript">
function makes_blank()
{
document.ccform.jemail.value ="";
}
</script>
<script type="text/javascript">
function make_blanks()
{
document.ccform.jfeed.value ="";
}
</script>
<style type="text/css">
h4{font-family:"trebuchet ms";color:#555}
#formes{align:center;width:469px;padding-top:10px;padding-bottom:10px;border:1px dotted #ccc;background-color:#FAFAFA;font-family:"trebuchet ms";font-size:12px;margin:auto 0}
#dropdown{width:355px;border:#ccc solid 1px;padding-left:44px;font-family:"trebuchet ms";font-size:13px;color:#555}
#fname{width:355px;border:#ccc solid 1px;background:#fff url(images/user.png) no-repeat left;padding-left:44px;font-family:"trebuchet ms";font-size:13px;color:#555}
#femail{width:355px;border:#ccc solid 1px;background:#fff url(images/email.png) no-repeat left;padding-left:44px;font-family:"trebuchet ms";font-size:13px;color:#555}
#sfeed{width:355px;border:#ccc solid 1px;background:#fff url(images/text_signature.png) no-repeat top left;padding-left:44px;font-family:"trebuchet ms";font-size:13px;color:#555}
#sbutton{width:82px;height:25px;border:0;display:block;background-image:url(images/button.png);background-repeat:no-repeat;font-family:"trebuchet ms";font-size:13px;color:#555}
</style>
</head>
<body>
<div align="center">
<?php
if(isset($_POST['submit']))
{
$dropdown $_POST['dropdown'];
$jname $_POST['jname'];
$jemail $_POST['jemail'];
$jfeed $_POST['jfeed'];
////////
$time date ("h:i A"); 
$date date ("l, F jS, Y");
$urlh getenv(HTTP_HOST);
$url "http://$urlh";
$ip $_SERVER['REMOTE_ADDR'];
$headers 'From: System Admin';
$subject "Info";
$body $_POST['body'];
$bodys "Message:\n$jfeed\n\nContact Us Form\n\n$date at $time.\n\nIP Address.$ip \n\nDropDown: $dropdown\n\nE Address: $jemail\n\nName: $jname \n\nUrl: $url "
///////////////
$name=array($dropdown,$jname,$jemail,$jfeed);
foreach (
$name as $name
{
if (
ereg("^\.",$name)) {
echo 
"<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>";  
 Die();
}
if (
ereg("\<"$name)) {
echo 
"<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>";  
 Die();
}
if (
ereg("\["$name)) {
echo 
"<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>";  
 Die();
}
if (
ereg("\`"$name)) {
echo 
"<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>";  
 Die();
}
if (
strlen($name) > 250) {
echo 
"<center><div id=\"formes\">The field cannot contain more than 150 characters:
<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>"
;  
 Die();
}
if (
strlen($name) < 4) {
echo 
"<center><div id=\"formes\">Min 4 characters:
<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>"
;  
 Die();
}
}
$body $body $bodys;
mail($email$subject$body"From: $email");
echo 
"<center><div id=\"formes\">Thank You</div></center>";  
}else{
?>

<h4>Contact Us</h4>
<form name=ccform id="formes" action="contact.php" method="post" onSubmit="return checkEmail(this)">
<p><select name="dropdown" id="dropdown">
<option value="Option1">Option 1</option>
<option value="Option2">Option 2</option>
<option value="Option3">Option 3</option>
</select></p>
<p><input name="jname" type="text" id="fname" value='Enter Your Name' onclick="make_blank();"></p>
<p><input name="jemail" type="text" id="femail" value='Enter Your Email' onclick="makes_blank();"></p>
<p><textarea name="jfeed" id="sfeed" value='Your Message' onclick="make_blanks();" rows="3" cols="25">Your Message</textarea></p>
<p><input id="sbutton" type="submit" name="submit" value="Submit"></p>
</form>
<?php
}
?>

</div>

Offline alex

  • Global Moderator
  • *****
  • Posts: 77
  • Karma: +20/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #37 on: December 19, 2011, 01:16:23 AM »
btw,  Function ereg() is deprecated.

replace this code

Code: [Select]
if (ereg("^\.",$name)) {
echo "<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>"; 
 Die();
}
if (ereg("\<", $name)) {
echo "<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>"; 
 Die();
}
if (ereg("\[", $name)) {
echo "<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>"; 
 Die();
}
if (ereg("\`", $name)) {
echo "<center><div id=\"formes\">Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></div></center>"; 
 Die();
}

with

Code: [Select]

if (preg_match("/</", $name)) {
            echo "<center><div id=\"toprow\">Invalid Characters \"<\" HTML is not allowed";
            Die();
        }
if (preg_match("/\\[/", $name)) {
            echo "<center><div id=\"toprow\">Invalid Characters \"[\" BB code is not allowed";
            Die();
        }

Offline boyfrom75

  • VIP
  • ****
  • Posts: 27
  • Karma: +5/-0
    • View Profile
Drop down menu..
« Reply #38 on: December 19, 2011, 01:18:17 PM »
 Perfect  ALEX  !!!

You are a Genius ... !

 Im very thanx-full for all the help I have receive in this forum..

 :( Im just sad because I made a nice Contact Us page with a click botton and a pop-Up frame and post in this forum.

The script was made using this same php Contact script with just some changes...and nobody like it... :(  I tough was nice , I think is a stupid script that is why nobody made comments in my small work.. lol

I was trying to make a small contribution to the forum..

here is the link...
:(

http://phpform.net/board/free-php-scripts/contact-us-2-0-with-html-page-and-pop-up-frame/


Offline ilrusso718

  • Supporter
  • **
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #39 on: January 24, 2012, 01:14:46 PM »
Hey, I am working on one of the sites that was done by someone else. there is a contact page with the contact form. It was missing a file " contactengine.pho  I downloaded your file and added one field to it.
I saved your form as a contactengine.php. When i click on "submit"  I get this message "Invalid Characters:Go Back".
below is a link to site, any advise will help me. Thanks.

http://sinyayaptitsa-bolotnie.com/contact.html


Offline michael33

  • Supporter
  • **
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #40 on: January 24, 2012, 03:12:09 PM »
Code: [Select]
<form method="post" action="contactengine.php">
                        <label for="Name">Name:</label>
                        <input type="text" name="jname" id="Name" />
                        <br />
                        <label for="City">City:</label>
                        <input type="text" name="City" id="City" />
                        <br />
                        <label for="Email">Email:</label>
                        <input type="text" name="jemail" id="Email" />
                        <br />
                        <label for="Message">Message:</label>
                        <textarea name="jfeed" rows="20" cols="20" id="Message"></textarea>

                        <input type="submit" name="submit" value="Submit" class="submit-button" />
                </form>
               

:)

Offline ilrusso718

  • Supporter
  • **
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #41 on: January 24, 2012, 04:52:37 PM »
thanx i will try it. :)

Offline djhayyy

  • Supporter
  • **
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #42 on: February 27, 2012, 06:52:18 AM »
hi i am having troubles regarding my school project. I cant seem to connect my website to the database as well as to handle form. I am quite new in this field and I would be very thankful for you guys if you help me. Thanks in advance

Offline janos

  • Contributor
  • *****
  • Posts: 53
  • Karma: +4/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #43 on: February 27, 2012, 08:44:57 AM »

Offline djhayyy

  • Supporter
  • **
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Contact Us 2.0.
« Reply #44 on: February 29, 2012, 06:22:34 AM »
thanks bro.my database is now connected with the website I can register and login or log out. thanks really bro