Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   Submit help (http://www.programmingforums.org/showthread.php?t=4004)

bulio May 20th, 2005 1:13 PM

Submit help
 
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.

The submit form I have can be found here: www.atgig.com/bulio

This is what I have, but I get a parse error:

:

<?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.";
}
?>


I get the following error when I try it:

Quote:

Parse error: parse error in C:\Documents and Settings\RMcDougall\Desktop\Website\Test Development\_debug_tmp.php on line 2

tempest May 20th, 2005 2:20 PM

You forgot an && between "(!empty($price))" and "(!empty($InventoryType))"

:

<?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.";
 }
 ?>


bulio May 20th, 2005 4:21 PM

OK everyone, I got it working! but everytime I try to submit, it says i'm missing a required field.

Code 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.";
}
?>


Also, Here's everything in the form:

http://pastebin.com/287113

Ooble May 20th, 2005 5:30 PM

What do you mean? Does it say "You have left a text box blank, please go back and fill it in."?

bulio May 22nd, 2005 1:22 PM

No, It gives me a parse error on line 2. I think it is due to my pc. I will be trying it on another one soon.


All times are GMT -5. The time now is 12:58 AM.

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