![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Hobbyist Programmer
Join Date: Jul 2004
Location: Location
Posts: 140
Rep Power: 5
![]() |
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> <B>Location of product:</B> <INPUT NAME="location">
<BR>
<BR>
<B>Description:</B> <INPUT NAME="Description" >
<BR>
<BR>
<B>Make:</B> <INPUT NAME="Make" >
<BR>
<BR>
<B>Model:</B> <INPUT NAME="Model" >
<BR>
<BR>
<B>Year:</B> <INPUT NAME="Year" >
<BR>
<BR>
<B>Color:</B> <INPUT NAME="Color" >
<BR>
<BR>
<B>Suggested list price:</B> <INPUT NAME="price" VALUE="$0.00" SIZE="16" style="WIDTH: 148px; HEIGHT: 22px" 0.00???>
<BR>
<BR>
<B>Inventory Type:</B> <INPUT NAME="InventoryType" style="WIDTH: 155px; HEIGHT: 22px" >
<BR>
<BR>
<B>Serial #:</B> <INPUT NAME="Serial" SIZE="22" style="WIDTH: 171px; HEIGHT: 22px">
<BR>
<B>Name of submitter:</B> <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. |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|