essentially, no.
PHP runs server side and the action of a form is generated client-side. To
run a PHP function the page needs to be resubmitted. The code you have
written will run the function before the page is submitted. try something
like ...
<?
function myfunction()
{ if($submit)
{ $result = mysql_query("INSERT INTO app
(name,company,address,suburb,state,post,areacode,phone,faxarea
code,fax,email,secret) VALUES
('$name','$company','$address','$suburb','$state','$post',
'$areacode','$phone','$faxareacode','$fax','$email','$secret')");
}
}
if ($thissubmit) myfunction();
?>
<form action="#?submit=<?php echo($submit) ?>&thissubmit=1">
Tim Ward
Senior Systems Engineer
Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html
> -----Original Message-----
> From: Peter Houchin [mailto:[EMAIL PROTECTED]]
> Sent: 27 February 2001 00:16
> To: PHP MAIL GROUP
> Subject: forms & functions
>
>
> Hiya,
>
> Can i call a function from the action line of a form?
>
> ie:
> <?
> function myfunction(){
> if($submit){
> $result = mysql_query("INSERT INTO app
> (name,company,address,suburb,state,post,areacode,phone,faxarea
> code,fax,email,secret) VALUES
> ('$name','$company','$address','$suburb','$state','$post','$ar
> eacode','$phone','$faxareacode','$fax','$email','$secret')");
> }
> }
> ?>
> <form action="<? myfunction(); ?>
>
> i would like to do it this way because i have a form on
> another page with passed the vaules thru to this one .. and i
> don't want it looking at the if($submit)
> Any help would be great
>
> Thanks
>
> Peter Houchin
> Sun Rentals
> [EMAIL PROTECTED]
>
>
--
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]