Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jun 21st, 2005, 1:33 PM   #1
bulio
Hobbyist Programmer
 
bulio's Avatar
 
Join Date: Jul 2004
Location: Location
Posts: 140
Rep Power: 5 bulio is on a distinguished road
Submitting problem

Hi everyone,

I have a product submit form for my company (coded in html). What I would like to do, is that if someone does not fill out all the required fields to submit the product, a php script would tell them something like:

Sorry, you have not filled in $fieldhere. Please go back and fill it in.

This is My current code: (index.htm)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>
     <TITLE>Coyote Product Submit Form</TITLE>
</HEAD>

<BODY>
     <H3 ALIGN="center">Coyote website product submit form</H3>

     <FORM ACTION="submit.php" METHOD="POST" ENCTYPE="text/plain">
         <TABLE>
               <TR>
                    <TD>&nbsp;&nbsp;<B>Location of product:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="location">
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Description:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Description" >
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Make:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Make" >
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Model:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Model" >
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Year:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Year" >
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Color:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Color" >
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Suggested list price:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="price" VALUE="$0.00" SIZE="16" style="WIDTH: 148px; HEIGHT: 22px" 0.00???>
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Inventory Type:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="InventoryType" style="WIDTH: 155px; HEIGHT: 22px" >
                    <BR>
                    <BR>
                    &nbsp;&nbsp;<B>Serial #:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="Serial" SIZE="22" style="WIDTH: 171px; HEIGHT: 22px">
                    <BR>
                    &nbsp;&nbsp;<B>Name of submitter:</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT NAME="name"></TD>

	       </TR>

               <TR>
                    <TD ALIGN="middle"><INPUT TYPE="submit" VALUE="Submit" STYLE="COLOR: #ffffff; BACKGROUND-COLOR: #000000"></TD>
               </TR>
          </TABLE>
     </FORM><A href="index.htm">Click Here</A> to submit another product to the site.
     <BR>
     <BR>
     <BR>



     <H3 ALIGN="center">Instructions</H3>
     <BR>
     <BR>

     <H5>1: Enter all required information into the text box. Avoid leaving blank spaces.
     <BR>
     <BR>
     2: Once you are completed, press the 'Submit' button. This will then open your e-mail client. Now you should see some text already already in the email.
     <BR>
     <BR>
     3: Now, add an attachment to the email. The attachment should be picture of the object that you want to sell.
     <BR>
     <BR>
     4: Send The email. (It will automatically be sent to the appropriate address)
     <BR>
     <BR>
     5: If you need assistance understanding the text boxes, please visit <A href="submit_help.htm">This Page</A>
     <BR>
     <BR>
     6: The information will soon be added to the site.</H5>
     <BR>

</BODY>
</HTML>

In submit.php:

<?php
 if ( (!empty($location)) && (!empty($Description)) && (!empty($Make)) && (!empty($Model)) && (!empty($Year)) && (!empty($Color)) && (!empty($price)) && (!empty($InventoryType)) && (!empty($Serial)) && (!empty($name)) )
 {
     echo "The product has been submitted ok.";
 }
 else
 {
     echo "You have left a text box blank, please go back and fill it in.";
 }
 ?>

This is the error that I get If I submit it with some fields blank:

Notice: Undefined index: location in c:\program files\easyphp1-8\www\submit.php on line 2
The product has been submitted ok.
bulio is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:44 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC