[PHP] Automatically update other sections of page

2003-06-10 Thread Michael Benbow
Hi,

I've created a very advanced web form which acts as an application and I am in 
desperate need of help.

The application works great, and it utilizes components such as combo boxes, 
checkboxes and radio buttons.  It is split into sections using iframes, meaning that 
each section is scrollable to display the full repitoire of available information.  

The problem I have is every time a piece of information is updated, whether it is a 
selection or an alteration, my application needs to reset a number of times to reflect 
the change from the top down.  The refresh allows my application to show the most 
current scenario, but the problem is there is a cascading effect and one click can 
result in three or four refreshes so that all the iframes are up to date.

What I'm wanting to know is whether there is a way that this information could be 
updated without the need of the refresh?  I'd need to update information above where 
the change took place, and some of the changes are simply text (ie an integer 
calculation could be different depending on which radio button is selected).  Is this 
possible?  I want to be able to click on a checkbox and the information related to 
that record is displayed below automatically without reloading or refreshing.

Please help!

Thanks,
Michael.

[PHP] Variable passing through a form

2002-11-20 Thread Michael Benbow

Hi,

I currently have a page divided into three areas, two of which are iframes.

The user selects a component out of part 1, which decides what is shown 
in part 2.  When something is clicked in part 2 the information updates 
in the second iframe, or part 3.  This is all working fine through 
$PHP_SELF and target.

I am now working in part 3 of my page which has already had variables 
passed to it from part 2, however when I try to make selections on this 
page which should update in the same area ($PHP_SELF) I am losing all 
the variables which were earlier passed.  I have tried $REQUEST_URI also 
which didn't help.

example:

after coming from part 2 $REQUEST_URI might be 
test.php?var1=a&var5=f&var16=d .  If I then select and option on this 
new form and then send it to itself I lose everything that was 
originally there (output might then be test.php?newvar=new)

The line which executes my form is (currently)  , and as I said $REQUEST_IRI does contain 
the variables on initial loading.  I need to keep these initial 
variables and add the new (ie test.php?var1=a&var5=f&var16=d&newvar=new)

Please help!

Thanks,
Michael.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Add On: Variable passing through a form

2002-11-20 Thread Michael Benbow
Sorry, but I forgot to say the variables froming from part 2 to part 3 can be anything between 1 and 30 or any combination thereof. 
will be no good here as it is too hard to pre-distringuish which variable names will be transferred

Thanks



Michael Benbow wrote:



Hi,

I currently have a page divided into three areas, two of which are 
iframes.

The user selects a component out of part 1, which decides what is 
shown in part 2.  When something is clicked in part 2 the information 
updates in the second iframe, or part 3.  This is all working fine 
through $PHP_SELF and target.

I am now working in part 3 of my page which has already had variables 
passed to it from part 2, however when I try to make selections on 
this page which should update in the same area ($PHP_SELF) I am losing 
all the variables which were earlier passed.  I have tried 
$REQUEST_URI also which didn't help.

example:

after coming from part 2 $REQUEST_URI might be 
test.php?var1=a&var5=f&var16=d .  If I then select and option on this 
new form and then send it to itself I lose everything that was 
originally there (output might then be test.php?newvar=new)

The line which executes my form is (currently)  , and as I said $REQUEST_IRI does 
contain the variables on initial loading.  I need to keep these 
initial variables and add the new (ie 
test.php?var1=a&var5=f&var16=d&newvar=new)

Please help!

Thanks,
Michael.



--
_________
Michael Benbow
Centre for Learning and Teaching Support
Gippsland Campus

IT Support Co-ordinator

Phone: +61 3 9902 6254
Fax:   +61 3 9902 6578
Web:   http://www.celts.monash.edu.au




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Find all combinations of numbers

2002-07-02 Thread Michael Benbow


Hi,

I searched through the archives and found the following snippit of code
from Tim Converse from late 2000.  This is great, but does anyone know
how I can adapt this so I can return all values from a multidimensional
array?  I have an id number which corresponds to a record which I need
to revisit once I get all possible combinations (not just the max which
below gives us) and I do not want to lose the link between the id and
the number.  For instance:

  $number[0]['id']=5;
  $number[0]['number']=500;
  $number[1]['id']=7;
  $number[1]['number']=500;
  $number[2]['id']=23;
  $number[2]['number']=750;
  $number[3]['id']=3;
  $number[3]['number']=1500;

$max is assigned the value 1350 in this example, so we know id 3 will be
eliminated off the bat.

What I need to get back are the combinations of ID's where their
corresponding number are less than or equal to value $max.  So in this
instance I might get something like;

5
7
23
5&7
5&23
7&23

I have spent about 40 hours in the last three days on this problem alone
and I can honestly say I am stuck.  You guys are my last hope.  Please
help a desperate man!

Thanks,
Michael.

-~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~-

Tim's code:

function maximum_subset_sum ($max, $candidate_array) {
  $working_array = array();
  while ($next = each($candidate_array)) {
$candidate = $next['value'];
$sums_to_date = array_keys($working_array);
while ($marked_sum = each($sums_to_date)) {
  $known_sum = $marked_sum['value'];
  $possibly_new = $known_sum + $candidate;
  if(($possibly_new <= $max) &&
 !IsSet($working_array[$possibly_new])){
$working_array[$possibly_new] = $candidate;
  }
}
if(($candidate <= $max) &&
   !IsSet($working_array[$candidate])){
  $working_array[$candidate] = $candidate;
}
  }
  $max_sum = max(array_keys($working_array));
  $return_array = array($working_array[$max_sum]);
  while ($max_sum != $working_array[$max_sum]) {
  $max_sum = $max_sum - $working_array[$max_sum];
array_push($return_array, $working_array[$max_sum]);
  }
  return($return_array);
}

// example use
$best_sum = maximum_subset_sum(40, array(39,23,19,14,9,5,3,2,1));
print("Largest sum is " . array_pop($best_sum));
while ($value = array_pop($best_sum)) {
   print(" + $value");
}  // will print "Best sum is 23 + 14 + 3"

-~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~-



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Retrieving text file

2001-10-29 Thread Michael Benbow


Hi All,

I am completely new to all this, so please bare with me.  I have
permission to use another person's text file which resides on his
server.  Currently I manually download the file, process it in Excel,
then upload it into my MySQL database.  I want to try to automate this
process, and the first step I see if getting the file from his server
onto mine for processing.  I will be using a cron job for this.

This is what I currently have, but I get errors...

$WebFile="http://www.somesite.com/somefile.txt";;
$LocalFile="/path/to/somefile.txt";

$handle = fopen ($WebFile, "r");
$outhandle=fopen ($LocalFile,"w");
while (!feof($handle)) {
$buffer=fread($handle,4096);
fputs($outhandle,$buffer);
}
fclose($handle);
fclose($outhandle);

When I try running this I get error after error:

Warning: fopen("http://www.somesite.com/somefile.txt","r";) - No error in
trial.php on line 5

Warning: Supplied argument is not a valid File-Handle resource in
trial.php on line 7

Warning: Supplied argument is not a valid File-Handle resource in
trial.php on line 8

The last two lines repeat themselves until the script times out.

Help!  I am desperate!!  The file definently exists but I am stuck.

Thank you,
Michael.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Fw: Processing checkboxes in Dynamic tables

2001-07-03 Thread Michael Benbow

My apologies,

I was playing with the code and changed something before sending...

Where it reads \n";

echo "";
 echo "";
 echo $trade;
echo "\n";

. 
$trade=$trade+1;
. 

} while.
  
etc.

Could someone please help me so only the variables which are checked before the submit 
button is pressed are parsed, eg p102, p107, p117, rather than every input variable 
which is initialised on the site?

Thank you heaps in advace,
Michael.



[PHP] Combo problems.. Multi Array??

2004-06-14 Thread Michael Benbow
Hi,
I've got a problem which has left me scratching my head for the better 
part of a week.  What I need to do is take x amount of items on one 
side, and somehow find all the combinations of y that fit in x.  Now I 
know this doesn't make much sense but it is very hard to explain, so I'm 
probably better off giving an example.

In this example just say I have three isntances of x; A, B and C.  x can 
grow to as much as 5 or 6 (D, E, F).

On the flipside I have two instances of y; [1] and [2]
I need to find how many combinations there are where y can fit in x.
The outcome, if working properly, should be...
A [1][2] BC
AB [1][2] C
ABC [1][2]
A [1]B [2]C
AB [1]C [2]
A [1]BC [2]
A [2]B [1]C
A [2]CC [1]
AB [2]C [1]
Does anyone have any ideas on how I could do this?  As I said I'm 
completely stumped.

Thanks,
Michael.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Combo problems.. Multi Array??

2004-06-14 Thread Michael Benbow
Thanks Mike,
I have read up a lot on permutation but I'm not completely sure that 
this will solve my problem.  From what I can gather permutation takes a 
sample (i.e. ABC) and tells you how many different ways it can arrange 
the letters, with order mattering.  What I need to do is take a variable 
number of groups (in my example, 3) and then display the combinations of 
ways that my sample (in my example, 2) can be spread across the groups.

I had a go at permutation based on your advice and while I was able to 
successfully find all the different combinations of ABC it did not help 
me in my need of dispersing the sample amongst the available groups.  
After I have my combinations I then need to process the data.

The example again is as follows..
A [1][2] BC
AB [1][2] C
ABC [1][2]
A [1]B [2]C
AB [1]C [2]
A [1]BC [2]
A [2]B [1]C
A [2]CC [1]
AB [2]C [1]
Think of the letters as being static amongst all possible combinations, and the 
numbers as the piece of data which is varying.  In my actual code both fields are 
integers but this isn't really important here.
Does anyone have any idea how I can do the above?
Thanks so much,
Michael.

Ford, Mike [LSS] wrote:
 

-Original Message-----
From: Michael Benbow [mailto:[EMAIL PROTECTED] 
Sent: 14 June 2004 08:31
To: [EMAIL PROTECTED]
Subject: [PHP] Combo problems.. Multi Array??

Hi,
I've got a problem which has left me scratching my head for 
the better 
part of a week.
   

[...]
 

The outcome, if working properly, should be...
A [1][2] BC
AB [1][2] C
ABC [1][2]
A [1]B [2]C
AB [1]C [2]
A [1]BC [2]
A [2]B [1]C
A [2]CC [1]
AB [2]C [1]
Does anyone have any ideas on how I could do this?  As I said I'm 
completely stumped.
   

This is called a permutation.  Googling for "permutation formula" brings up
any number of good links; the most succinct is probably
http://www.mathwords.com/p/permutation_formula.htm, but most of the other
top 10 links will give you the same answer with a bit (or a lot!) more
explanation.
Cheers!
Mike
-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
 

--
IT Co-ordinator
Centre for Learning and Teaching Support
Monash University
http://www.celts.monash.edu.au