Current location: Hot Scripts Forums » Programming Languages » PHP » Feedback form with double check


Feedback form with double check

Reply
  #1 (permalink)  
Old 06-16-03, 12:11 PM
plathw plathw is offline
New Member
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Feedback form with double check

Does any one know a cgi/php form to mail applet that will allow the admin to make sure two fields are the same? Where the user has to retype thier phone number, and it must be the same in order to submit the form?

Thanks,

Brian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-16-03, 01:59 PM
Steven Steven is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Singapore
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
u can just add the code in for php..

<?php

if ($HTTP_POST_VARS['tel1'] != $HTTP_POST_VARS['tel2']) {

echo "error";

}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-16-03, 02:44 PM
SilkySmooth's Avatar
SilkySmooth SilkySmooth is offline
Newbie Coder
 
Join Date: Jun 2003
Location: In the PHP Engine :-)
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Just to emulate on Steven's post, if you have access to the superglobals you should use them instead.

PHP Code:

<?php


if ($_POST['tel1'] != $_POST['tel2']) {

echo 
"error";

}

?>
__________________
---------------------
-- SilkySmooth --
---------------------
Directory Share | Free phpLD Mods
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 06-22-03, 10:17 AM
plathw plathw is offline
New Member
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks, but where whould I put that code? In the script or in my html? And where in the script or html would it go? Sorry if that's a stupid question, but I'm pretty new to all of this...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 06-22-03, 10:20 AM
plathw plathw is offline
New Member
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Well, I just put it in the html and it displayed "error" on the next page, but is there a way to make it pop up an error box and not send the information unless the two fields are the same?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 06-22-03, 11:58 AM
ChristGuy ChristGuy is offline
Operations Support Develo
 
Join Date: Jun 2003
Location: Rivonia, South Africa
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Greetingz...

Firstly try (It's not PHP but it works...):

PHP Code:

<SCRIPT LANGUAGE="JavaScript">

  function 
checkData()
  {
    if (
document.myForm.TelNo1.value == document.myForm.TelNo2.value)
    {
      return 
true;
    }
    else
    {
      
alert("Please enter the same telephone number");
      return 
false;
    }
  }
</SCRIPT>
<FORM ACTION="proccessform.php" NAME="myForm" onSubmit="return checkData()">
  Name: <INPUT TYPE="TEXT" NAME="Name"><BR>
  Tel1: <INPUT TYPE="TEXT" NAME="TelNo1"><BR>
  Tel2: <INPUT TYPE="TEXT" NAME="TelNo2"><BR>
  <INPUT TYPE="SUBMIT" NAME="btnSubmit"><BR>
</FORM> 
Secondly the following is used in the Handler script of the form:
PHP Code:

<?php

  
if ($_POST['TelNo1'] != $_POST['TelNo2'])
  {
    echo 
"error";
  }
?>
Hope that helps...
__________________
Till We Meet Again...
Clifford W. Hansen
Aspivia (Pty) Ltd

"We Have Seen Strange Things Today!" Luke 5:26
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkboxes on form = mailto recipient. Bojon PHP 4 12-21-04 07:07 PM
SQL database registration form help vinhkhuong PHP 3 10-10-03 04:49 AM
Help with feedback form sukino ASP 2 09-24-03 11:30 PM
asp: URGENT! need to change code to create new form per id seala ASP 2 09-09-03 10:54 PM
asp: checkboxes & multi-page form seala ASP 0 09-02-03 02:58 PM


All times are GMT -5. The time now is 12:55 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.