Current location: Hot Scripts Forums » Programming Languages » PHP » validating information


validating information

Reply
  #1 (permalink)  
Old 07-01-04, 03:22 PM
tcooper tcooper is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
validating information

I have a form that I am submitting to itself about halfway through in order to check key fields for information. I know this is simple, and I am sure I have seen it on this discussion but I can't seem to get it figured out.

I have a variable $ckSubmit that I am using to see if my form has been submitted. If the form has been submitted $ckSubmit is incremented by 1.

My code looks something like this...

if ($ckSubmit==2) {
if ($jobdesc=='') echo '<script type = "text/javascript"> alert("Please enter a Project Name");</script>';
if ($client=='A') echo '<script type = "text/javascript"> alert("Please enter a Client Name");</script>';


I know there is an easier way to do this but just need some help.
Reply With Quote
  #2 (permalink)  
Old 07-02-04, 03:48 AM
gmoney gmoney is offline
New Member
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
I don't know why you have to increment the submit may be there is a reason for that? i take it that ckSubmit is the name of the submit button?.

i hope this solves your problem!


Try this! put it in top of the form u use.

PHP Code:

if ($_POST[ckSubmit])

{
   if (!
$_POST[jobdesc])
   {
   echo 
'<script type = "text/javascript"> alert("Please enter a Project Name");</script>'
   
$error=1;
   }
   if (
$_POST[client]=='A')
   {
   echo 
'<script type = "text/javascript"> alert("Please enter a Client Name");</script>'
   
$error=1;
   }

  if (!
$error)
  {
   
// form is valid do something
  
exit;
  }

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
sending information fabulosas10 PHP 1 06-26-04 02:13 AM
retaining information between pages davidklonski PHP 0 05-31-04 05:36 PM
Enter information into fields, creates XML file on the fly ziphem Script Requests 1 04-28-04 06:55 PM
Validating information? tcooper PHP 1 11-20-03 12:51 PM
Help Transfering information praeclarus PHP 1 07-24-03 06:03 PM


All times are GMT -5. The time now is 05:08 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.