473,467 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

OK this is an easy one for someone!

OK I'm sooo new to this, but so far i have managed to create a form (like a
shopping list) in one page which looks like this where i can put quantities
in on one page.

www.martinhawken.com/php.php

Then it passes the form info onto my next page which displays a list and
totals. But how, pray, would I make it miss out items on my second page
where they have a value on null? You see I would rather just have the items
where I have actually given a value! Is it some kind of if else statement
possibly followed by the ! mark to reverse the flag or summat?

Any help? I only started this PHP thing 2 days ago!!
Cheers,

Steve
Jul 17 '05 #1
6 1526
Steve wrote:

OK I'm sooo new to this, but so far i have managed to create a form (like a
shopping list) in one page which looks like this where i can put quantities
in on one page.

www.martinhawken.com/php.php

Then it passes the form info onto my next page which displays a list and
totals. But how, pray, would I make it miss out items on my second page
where they have a value on null? You see I would rather just have the items
where I have actually given a value! Is it some kind of if else statement
possibly followed by the ! mark to reverse the flag or summat?


You could do something like:

foreach($_REQUEST as $key->$var)
if ($var == "")
unset($_REQUEST[$key]);

print_r($_REQUEST);

But that might not be ideal...

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #2
you could just check the $item1 for null
so something like this
if($item1 != "") {
echo "500 Wire Shelf - Number of items @ £14.00 : ".$item1;
}

and then same with $item2, $item*

"Steve" <lu***********@hotmail.com> wrote in message
news:40**********************@news.astraweb.com...
OK I'm sooo new to this, but so far i have managed to create a form (like a shopping list) in one page which looks like this where i can put quantities in on one page.

www.martinhawken.com/php.php

Then it passes the form info onto my next page which displays a list and
totals. But how, pray, would I make it miss out items on my second page
where they have a value on null? You see I would rather just have the items where I have actually given a value! Is it some kind of if else statement
possibly followed by the ! mark to reverse the flag or summat?

Any help? I only started this PHP thing 2 days ago!!
Cheers,

Steve

Jul 17 '05 #3
Might want to cast the variable to int first, so that an spaces and
non-numeric entries are ignored

$item1 = (int) $item1;
if($item1) { ...

Uzytkownik "Stormkid" <ba*****@goldengate.net> napisal w wiadomosci
news:40***********************@newsreader.goldenga te.net...
you could just check the $item1 for null
so something like this
if($item1 != "") {
echo "500 Wire Shelf - Number of items @ £14.00 : ".$item1;
}

and then same with $item2, $item*

"Steve" <lu***********@hotmail.com> wrote in message
news:40**********************@news.astraweb.com...
OK I'm sooo new to this, but so far i have managed to create a form (like
a
shopping list) in one page which looks like this where i can put

quantities
in on one page.

www.martinhawken.com/php.php

Then it passes the form info onto my next page which displays a list and
totals. But how, pray, would I make it miss out items on my second page
where they have a value on null? You see I would rather just have the

items
where I have actually given a value! Is it some kind of if else

statement possibly followed by the ! mark to reverse the flag or summat?

Any help? I only started this PHP thing 2 days ago!!
Cheers,

Steve


Jul 17 '05 #4
Thanks, all of you - you guys are the BEST!! It all worked! Friday 13th is a
sweet one this morning!:

www.martinhawken.com/php.php

Thanks, Shawn - your version was a couple of steps more advanced than my
brain can currently take, so i used Stormkids (Thanks SK), please don't take
offence, maybe you can help me again when I'm up to speed! Chung's line of
code worked great, too!

Cheers!

Steve
Jul 17 '05 #5
OK so far so good, now if someone could point me roughly in the direction of
how to get this data sent to an email address *without* using the dreaded
'mailto:' my weekend would be made!?

Thanks!

Steve
Jul 17 '05 #6
Steve wrote:
OK so far so good, now if someone could point me roughly in the direction of
how to get this data sent to an email address *without* using the dreaded
'mailto:' my weekend would be made!?

Thanks!

Steve


You want the mail() function
http://www.php.net/manual/en/function.mail.php

[ Don't forget to configure php.ini to allow sending mails ]

For example (with a few undefined variables thrown-in, that you have to
replace):

<?php
if ($everything_ok) {
update_db(); // or whatever you have
$message = "new data has been inserted into the db:

field1: $field1
field2: $field2";
mail($your_address, 'new data', $message);
}
?>
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: yoyoyo | last post by:
hi everybody! i'm trying to learn javascript in order to build a function that i need to put in my website.. since i have not so much time to do that i decided to ask to u in the net..probably...
36
by: No Spam | last post by:
Dear fellow Access 2003 Users, Is there a way to trim all of the fields in a table in one swoop using VBA (preferred) or a query? Right now, I am using an update query and updating EACH field...
1
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real...
1
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real...
14
by: google | last post by:
I am creating a new database for use within our company, that I'd like to make reasonably secure (short of a true server based solution). The back-end of a non-server based database seems to be...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.