we need more code than <? makeArrays(); ?>...

By the looks of that alone, it appears that you have that inserted into the
html somewhere around the submit button.  If that is the case, the function
will run every time you load the page.  You have to set a trigger to
determine whether it should run or not.  For instance, the form in which the
submit button is in can have a variable such as <input type=hidden
name=executeRand value=1> so that when you hit submit, that value is sent to
the target of the form, (which I take it is this same page).  The code
around the function in php could be...

if($executeRand == 1){ makeArrays(); }

You'll need a second form around your other submit along with a variable for
it to send etc.

Hope that helps....

Larry

-----Original Message-----
From: wknit [mailto:[EMAIL PROTECTED]
Sent: Monday, January 05, 2004 8:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Submit Button Refresh Problem?


I have a php file that contains all the functions that I run on the page
that is displayed, self-contained.

The main function is <? makeArrays(); ?>

I am invoking that function with a Submit button OnClick event.

Whenever I click the button, the page refreshes and the function runs just
fine displaying a dynamically generated random sequence of numbers.

The problem is the page refresh itself.

When the page first loads the function runs and it shouldn't, the display
should be blank until the button is clicked.

This is a problem because I have another button that will be coded to write
the data generated to a database, at present that function is empty, however
when I click that button the page refreshes again and the number data
changes.

How do I keep the page from refreshing on load and apparently self clicking
the form button, and how do I keep the page from refreshing and running the
'makearrays' function when I click the 'writedata' function?  When the
'writedata' function is invoked from a button click only that function
should be called and the data from the previous page should be returned to
the page again (same).. i.e. the random number sequence does not change.

Thanks!

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

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

Reply via email to