php-windows Digest 19 Aug 2002 04:38:52 -0000 Issue 1296
Topics (messages 15335 through 15339):
Newbie - Form Submission Question
15335 by: theN
15336 by: Joachim Krebs
15337 by: theN
15338 by: Joachim Krebs
max_execute_time does not work on infinitely loop
15339 by: NoWhErEMan
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi
I've a FORM like this on addhome.html --
<FORM name="frmlogin" method="post" action="log_make.php">
User Name:<INPUT type="text" maxlength="10" name="username">
Password:<INPUT type="password" maxlength="10" name="password"><BR>
<INPUT type="button" value="Login" name="butloginusr">
<INPUT type="button" value="Create User" name="butmakeusr">
</FORM>
The idea is when the user clicks on the button "name=butloginusr" the
next page prints Logged In User along with the values of the $username &
$password OR when the user clicks button "name=butmakeusr" the next page
prints Created User along with the values of the $username & $password.
Both the clicks would be processed by log_make.php.
* How can I make log_make.php recognise the button that was clicked i.e.
Did the page viewer want to login or create a user?
* Can I remove the attribute "action=log_make.php" and assign individual
scripts to each of the buttons? When I tried this the server said I
could not do a POST on address/addhome.html.
/***************
My system config is as follows -
OS: Win'98
PHP Version:4.2.2 (w/ Register Global Variables=On)
Apache Version:1.3.26
Physical Directory of Files: C:\server\Apache\htdocs\address
****************/
Any help or suggestions would be greatly appreciated.
Thanks
theN
--- End Message ---
--- Begin Message ---
First of all let me scold you for running Apache and PHP on Windows
9x.
The solution would be to make two inputs of type "submit" that have
the same name but different values. Then when the form is submitted
you check the variable $button_name and execute the relevant code.
--- End Message ---
--- Begin Message ---
Then wrote:
Hi
I've a FORM like this on addhome.html --
<FORM name="frmlogin" method="post" action="log_make.php">
User Name:<INPUT type="text" maxlength="10" name="username">
Password:<INPUT type="password" maxlength="10" name="password"><BR>
<INPUT type="button" value="Login" name="butloginusr">
<INPUT type="button" value="Create User" name="butmakeusr">
</FORM>
The idea is when the user clicks on the button "name=butloginusr" the
next page prints Logged In User along with the values of the $username &
$password OR when the user clicks button "name=butmakeusr" the next page
prints Created User along with the values of the $username & $password.
Both the clicks would be processed by log_make.php.
* How can I make log_make.php recognise the button that was clicked i.e.
Did the page viewer want to login or create a user?
* Can I remove the attribute "action=log_make.php" and assign individual
scripts to each of the buttons? When I tried this the server said I
could not do a POST on address/addhome.html.
/***************
My system config is as follows -
OS: Win'98
PHP Version:4.2.2 (w/ Register Global Variables=On)
Apache Version:1.3.26
Physical Directory of Files: C:\server\Apache\htdocs\address
****************/
Any help or suggestions would be greatly appreciated.
Thanks
theN
Joachim Krebs wrote:
> First of all let me scold you for running Apache and PHP on Windows
> 9x.
>
> The solution would be to make two inputs of type "submit" that have
> the same name but different values. Then when the form is submitted
> you check the variable $button_name and execute the relevant code.
>
>
Hi
Much obliged for the prompt response. I changed the FORM according to
your suggestion --
<FORM name="frmlogin" class="login" id="login" method="post"
action="log_make.php">
User Name:<INPUT type="text" maxlength="10" tabindex="1" name="username"
id="username">
Password:<INPUT type="password" maxlength="10" tabindex="2"
name="password" id="password"><BR><BR>
<INPUT type="submit" name="butusr" value="Login">
<INPUT type="submit" name="butusr" value="Create">
</FORM>
and I coded log_make.php as follows
/*BEGIN log_make.php*/
switch($butusr)
{
case "Login":
echo("You Logged in with - ".$username ."&". $password);
break;
case "Create":
echo("Created User with - ".$username ."&". $password);
break;
}
/*END log_make.php*/
:-) It worked right the first time.
With regards to my original post, could you kindly give your input on
the following --
* Can I remove the attribute "action=log_make.php" and assign individual
scripts to each of the buttons? When I tried this the server said I
could not do a POST on address/addhome.html.
Thanks and Regards
theN
--- End Message ---
--- Begin Message ---
As far as I know, each <form> tag can only have one action that is
executed by any submit buttons in that form. You can however use the
Javascript modifier onClick="" to call different javascript functions
with each button. Where you go from there I don't know. If it were to
me, I would have both buttons submit to the same script and go there.
With the onClick modifier - An example which will open a Javascript
alert box:
<input type="button" onClick="javascript:alert('This is an onClick test');">
theN wrote:
With regards to my original post, could you kindly give your input on
the following --
* Can I remove the attribute "action=log_make.php" and assign individual
scripts to each of the buttons? When I tried this the server said I
could not do a POST on address/addhome.html.
Thanks and Regards
theN
--- End Message ---
--- Begin Message ---
Hi all,
I have set the max_execute_time in php.ini to 300 (5 mins).
And i found that if my script have a infinitely loop( caused by careless
programming),
the script still executing even 5 mins is passed and uses up all my cpu
resourse.
Even i "stop" and close the browser, the script seen still running on the
background.
(I found the apache.exe is used up 99% of cpu resourse in window task
manager)
What i can do is restart the apache server.
I use the following script to test the situation.
<?php
while (1<10){
$i=1;}
?>
So is there any way to stop execution of php script?
Since i have make a server for my friend to test his php script,
sometime if his script have such a bad looping, the apache would hanged.
I dont want to restart the server everytime since i;m not sitting in front
my pc anytime.
Thanks in advance
Nowhereman from HK
--- End Message ---