![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Hobbyist Programmer
Join Date: Jul 2004
Location: Location
Posts: 138
Rep Power: 5
![]() |
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:
|
|
|
|
|
|
|
#2 |
|
Programming Guru
![]() |
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.";
}
?>
__________________
|
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Jul 2004
Location: Location
Posts: 138
Rep Power: 5
![]() |
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 |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
What do you mean? Does it say "You have left a text box blank, please go back and fill it in."?
|
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Jul 2004
Location: Location
Posts: 138
Rep Power: 5
![]() |
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.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|