Here's a nifty trick.
Name your check boxes like this.
input type=checkbox name=myarray[] value=value1 /
input type=checkbox name=myarray[] value=value2 /
input type=checkbox name=myarray[] value=value3 /
input type=checkbox name=myarray[] value=value4 /
Then when it posts back to php, you
My question might have anything to do with PHP but I have the following
scenario:
Say I have four fields
field1 :
field2 :
field3 :
field4 :
And a total sum field, which is a total sum of the value of the
expression, totalsum = field1 +
Hi,
In your javascript try
field1=Number(thisform.field1.value) etc...
Cheers
Simon
-Original Message-
From: Shahmat Dahlan [mailto:[EMAIL PROTECTED]]
Sent: 11 October 2002 11:35
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Javascript
My question might have anything to do with PHP but I
maybe i dont get the question,
but for all records for the last 24 hours (1 day) i use:
this is an insteresting page:
http://www.mysql.com/doc/en/Date_and_time_functions.html
i says:
Here is an example that uses date functions. The following query selects all
records with a date_col value
I will try your method.
I have found a way to solved this problem of mine.
I have four fields I may or may not choose to fill up one out of the four
fields, or I might filled up all of them.
So when I leave one or two fields empty, and add all the value up, I will
get NaN.
For those empty
I have met this problem before.
The only solution I have found is to assign 0 values to the INPUT tags:
input type=text name=field1 addChange=add(); value=0
HTH
Ignatius
- Original Message -
From: Shahmat Dahlan [EMAIL PROTECTED]
To: [EMAIL
PASSWORD() always returns a string that's 16 characters long.
---John Holmes...
-Original Message-
From: Tim Haak [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 11, 2002 8:05 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Selecting PASSWORD() value in MySQL
Hi,
convert your date to UNIX_TIMESTAMP, which is number of seconds since
1.1.1970, and you can use simple math, as in
$query=mysql_query(
SELECT dtg
FROM techs
WHERE
tech='$user'
AND
UNIX_TIMESTAMP(dtg) UNIX_TIMESTAMP(NOW()) - 86400
AND
HOUR(dtg)=7
The query didn't return any rows when the only row in the table matched the criteria.
Someone else suggested adjusting the field width in the table which worked. I didn't
think the PASSWORD() function added that many additional characters (5 character
password resulted in a string longer
if(date(H)7))
{
$var1 = 1;
$var2 = 0;
}
else
{
$var1 = 0;
$var2 = 1;
}
Then use this query:
SELECT dtg FROM techs WHERE tech='$user' AND (TO_DAYS(dtg) =
TO_DAYS(CURRENT_DATE) - $var1 DAY AND HOUR(dtg) 7) AND (TO_DAYS(dtg) =
TO_DAYS(CURRENT_DATE) + $var2 DAY AND HOUR(dtg) 7)
I _think_
I don't think this would work. You're asking for rows where the date is
greater than 24 hours ago, and the hour is greater than seven. So, if
it's 8 am in the morning, you'll get results from 8 am yesterday until
midnight, then from 7 am today until 8 am today. You'll miss the rows
from midnight
Try this:
The HTML codes should look like this:
input type=text name=field[] onChange=add();
input type=text name=field[] onChange=add();
input type=text name=field[] onChange=add();
input type=text name=field[] onChange=add();
input type=text name=totalsum
function add() {
var total = 0;
Thanks for the tip.
Well,
my problem came from that parseInt() did not do the expected job. Like in:
field1 = parseInt( thisform.field1.value ) + parseInt(
thisform.field2.value ) ;
If you happen to know the reason, I would love to know.
Ignatius
13 matches
Mail list logo