Discussion:
php embeded in html after first submit html disappear
Janet N
2008-01-30 05:51:39 UTC
Permalink
Hi there,

I have two forms on the same php page. Both forms has php embeded inside
html with it's own submit button.

How do I keep the second form from not disappearing when I click submit on
the first form? My issue is that when I click the submit button from the
first
form (register), the second form (signkey) disappear. Code below, any
feedback is appreciated:


<form name="register" method="post" action="/DKIMKey.php">
<input type="submit" name="register" value="Submit Key">

<?php
if (isset($_POST['register']))
{
$register = $_POST['register'];
}
if (isset($register))
{
$filename = '/usr/local/register.sh';
if(file_exists($filename))
{
$command = "/usr/local/register.sh ";
$shell_lic = shell_exec($command);
echo "<font size=2 color=blue>$shell_lic</font>";
}
}
?>
</form>



<form name="signkey" action="/DKIMKey.php" method="post"> <label
domain="label">Enter the domain name: </label>
<input name="domain" type="text"> <input type="submit" name="makesignkey"
value="Submit"

<?php
if (isset($_POST['makesignkey']))
{
$makesignkey = $_POST['makesignkey'];
}
if (isset($makesignkey))
{
if(isset($_POST['domain']))
{
$filename = '/usr/local//keys/generatekeys';
if(file_exists($filename))
{
$domain = $_POST['domain'];
$command = "/usr/local/keys/generatekeys " . $domain;

$shell_createDK = shell_exec($command);
print("<p><font size=2
color=blue>$shell_createDK</font></p>");
}
}
?>
</form>
Jochem Maas
2008-01-30 11:16:14 UTC
Permalink
Post by Janet N
Hi there,
I have two forms on the same php page. Both forms has php embeded inside
html with it's own submit button.
How do I keep the second form from not disappearing when I click submit on
the first form? My issue is that when I click the submit button from the
first
form (register), the second form (signkey) disappear. Code below, any
we the users clicks submit the form is submitted and a new page is returned. nothing
you can do about that (unless you go the AJAX route, but my guess is that's a little
out of your league given your question).

why not just use a single form that they can fill in, nothing in the logic
seems to require that they are seperate forms.

BTW your not validating or cleaning your request data. what happens when I submit
$_POST['domain'] with the following value?

'mydomain.com ; cd / ; rm -rf'

PS - I wouldn't try that $_POST['domain'] value.
PPS - font tags are so 1995
Post by Janet N
<form name="register" method="post" action="/DKIMKey.php">
<input type="submit" name="register" value="Submit Key">
<?php
if (isset($_POST['register']))
{
$register = $_POST['register'];
}
if (isset($register))
{
$filename = '/usr/local/register.sh';
if(file_exists($filename))
{
$command = "/usr/local/register.sh ";
$shell_lic = shell_exec($command);
echo "<font size=2 color=blue>$shell_lic</font>";
}
}
?>
</form>
<form name="signkey" action="/DKIMKey.php" method="post"> <label
domain="label">Enter the domain name: </label>
<input name="domain" type="text"> <input type="submit" name="makesignkey"
value="Submit"
<?php
if (isset($_POST['makesignkey']))
{
$makesignkey = $_POST['makesignkey'];
}
if (isset($makesignkey))
{
if(isset($_POST['domain']))
{
$filename = '/usr/local//keys/generatekeys';
if(file_exists($filename))
{
$domain = $_POST['domain'];
$command = "/usr/local/keys/generatekeys " . $domain;
$shell_createDK = shell_exec($command);
print("<p><font size=2
color=blue>$shell_createDK</font></p>");
}
}
?>
</form>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Janet N
2008-01-31 01:04:56 UTC
Permalink
is it possible to use "input type="hidden" for signkey form and put it in
the register form before the submit button? I'm not sure but
is it possible to use hidden to make this work?

Thanks.
Post by Janet N
Post by Janet N
Hi there,
I have two forms on the same php page. Both forms has php embeded
inside
Post by Janet N
html with it's own submit button.
How do I keep the second form from not disappearing when I click submit
on
Post by Janet N
the first form? My issue is that when I click the submit button from
the
Post by Janet N
first
form (register), the second form (signkey) disappear. Code below, any
we the users clicks submit the form is submitted and a new page is returned. nothing
you can do about that (unless you go the AJAX route, but my guess is that's a little
out of your league given your question).
why not just use a single form that they can fill in, nothing in the logic
seems to require that they are seperate forms.
BTW your not validating or cleaning your request data. what happens when I submit
$_POST['domain'] with the following value?
'mydomain.com ; cd / ; rm -rf'
PS - I wouldn't try that $_POST['domain'] value.
PPS - font tags are so 1995
Post by Janet N
<form name="register" method="post" action="/DKIMKey.php">
<input type="submit" name="register" value="Submit Key">
<?php
if (isset($_POST['register']))
{
$register = $_POST['register'];
}
if (isset($register))
{
$filename = '/usr/local/register.sh';
if(file_exists($filename))
{
$command = "/usr/local/register.sh ";
$shell_lic = shell_exec($command);
echo "<font size=2 color=blue>$shell_lic</font>";
}
}
?>
</form>
<form name="signkey" action="/DKIMKey.php" method="post"> <label
domain="label">Enter the domain name: </label>
<input name="domain" type="text"> <input type="submit"
name="makesignkey"
Post by Janet N
value="Submit"
<?php
if (isset($_POST['makesignkey']))
{
$makesignkey = $_POST['makesignkey'];
}
if (isset($makesignkey))
{
if(isset($_POST['domain']))
{
$filename = '/usr/local//keys/generatekeys';
if(file_exists($filename))
{
$domain = $_POST['domain'];
$command = "/usr/local/keys/generatekeys " . $domain;
$shell_createDK = shell_exec($command);
print("<p><font size=2
color=blue>$shell_createDK</font></p>");
}
}
?>
</form>
Jochem Maas
2008-01-31 01:30:49 UTC
Permalink
Post by Janet N
is it possible to use "input type="hidden" for signkey form and put it in
the register form before the submit button? I'm not sure but
is it possible to use hidden to make this work?
what are you trying to do? do you want to have people fill in both forms
at once then process them serially (i.e. in 2 different requests) ...
if so then break up the forms in to 2 pages ... if not I can't figure out
what you want to do at all. please explain.
Post by Janet N
Thanks.
Post by Janet N
Post by Janet N
Hi there,
I have two forms on the same php page. Both forms has php embeded
inside
Post by Janet N
html with it's own submit button.
How do I keep the second form from not disappearing when I click submit
on
Post by Janet N
the first form? My issue is that when I click the submit button from
the
Post by Janet N
first
form (register), the second form (signkey) disappear. Code below, any
we the users clicks submit the form is submitted and a new page is returned. nothing
you can do about that (unless you go the AJAX route, but my guess is that's a little
out of your league given your question).
why not just use a single form that they can fill in, nothing in the logic
seems to require that they are seperate forms.
BTW your not validating or cleaning your request data. what happens when I submit
$_POST['domain'] with the following value?
'mydomain.com ; cd / ; rm -rf'
PS - I wouldn't try that $_POST['domain'] value.
PPS - font tags are so 1995
Post by Janet N
<form name="register" method="post" action="/DKIMKey.php">
<input type="submit" name="register" value="Submit Key">
<?php
if (isset($_POST['register']))
{
$register = $_POST['register'];
}
if (isset($register))
{
$filename = '/usr/local/register.sh';
if(file_exists($filename))
{
$command = "/usr/local/register.sh ";
$shell_lic = shell_exec($command);
echo "<font size=2 color=blue>$shell_lic</font>";
}
}
?>
</form>
<form name="signkey" action="/DKIMKey.php" method="post"> <label
domain="label">Enter the domain name: </label>
<input name="domain" type="text"> <input type="submit"
name="makesignkey"
Post by Janet N
value="Submit"
<?php
if (isset($_POST['makesignkey']))
{
$makesignkey = $_POST['makesignkey'];
}
if (isset($makesignkey))
{
if(isset($_POST['domain']))
{
$filename = '/usr/local//keys/generatekeys';
if(file_exists($filename))
{
$domain = $_POST['domain'];
$command = "/usr/local/keys/generatekeys " . $domain;
$shell_createDK = shell_exec($command);
print("<p><font size=2
color=blue>$shell_createDK</font></p>");
}
}
?>
</form>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Janet N
2008-01-31 02:09:45 UTC
Permalink
Hi Jochem,

Thanks for the prompt response. No I do not want people to fill in both
forms at once.

I actually have a three step process. I simplified it to two because if I
can get two steps to work, I should be good to go. Each step depends on the
preceding step having completed successfully. Users therefore need a
success message after each step is successfully completed. We cannot
require that users do all steps in one sitting. It must be possible to do
step one, leave, come back the next day and do 2,etc.

Because there is not enough to each step to justify a full web page devoted
to it alone, I have decided to keep all steps on one page.

Is there any way to use the "hidden" attribute of HTML variables to prevent
the output message from overwriting the page?
Post by Jochem Maas
Post by Janet N
is it possible to use "input type="hidden" for signkey form and put it
in
Post by Janet N
the register form before the submit button? I'm not sure but
is it possible to use hidden to make this work?
what are you trying to do? do you want to have people fill in both forms
at once then process them serially (i.e. in 2 different requests) ...
if so then break up the forms in to 2 pages ... if not I can't figure out
what you want to do at all. please explain.
Post by Janet N
Thanks.
Post by Janet N
Post by Janet N
Hi there,
I have two forms on the same php page. Both forms has php embeded
inside
Post by Janet N
html with it's own submit button.
How do I keep the second form from not disappearing when I click
submit
Post by Janet N
Post by Janet N
on
Post by Janet N
the first form? My issue is that when I click the submit button from
the
Post by Janet N
first
form (register), the second form (signkey) disappear. Code below, any
we the users clicks submit the form is submitted and a new page is returned. nothing
you can do about that (unless you go the AJAX route, but my guess is that's a little
out of your league given your question).
why not just use a single form that they can fill in, nothing in the
logic
Post by Janet N
Post by Janet N
seems to require that they are seperate forms.
BTW your not validating or cleaning your request data. what happens
when I
Post by Janet N
Post by Janet N
submit
$_POST['domain'] with the following value?
'mydomain.com ; cd / ; rm -rf'
PS - I wouldn't try that $_POST['domain'] value.
PPS - font tags are so 1995
Post by Janet N
<form name="register" method="post" action="/DKIMKey.php">
<input type="submit" name="register" value="Submit Key">
<?php
if (isset($_POST['register']))
{
$register = $_POST['register'];
}
if (isset($register))
{
$filename = '/usr/local/register.sh';
if(file_exists($filename))
{
$command = "/usr/local/register.sh ";
$shell_lic = shell_exec($command);
echo "<font size=2 color=blue>$shell_lic</font>";
}
}
?>
</form>
<form name="signkey" action="/DKIMKey.php" method="post"> <label
domain="label">Enter the domain name: </label>
<input name="domain" type="text"> <input type="submit"
name="makesignkey"
Post by Janet N
value="Submit"
<?php
if (isset($_POST['makesignkey']))
{
$makesignkey = $_POST['makesignkey'];
}
if (isset($makesignkey))
{
if(isset($_POST['domain']))
{
$filename = '/usr/local//keys/generatekeys';
if(file_exists($filename))
{
$domain = $_POST['domain'];
$command = "/usr/local/keys/generatekeys " . $domain;
$shell_createDK = shell_exec($command);
print("<p><font size=2
color=blue>$shell_createDK</font></p>");
}
}
?>
</form>
Nathan Nobbe
2008-01-31 04:50:25 UTC
Permalink
Post by Janet N
Because there is not enough to each step to justify a full web page devoted
to it alone, I have decided to keep all steps on one page.
even if you manage this with a single php file, you should consider showing
only the relevant form for the given segment of the overall process to the user.
as a simple approach, you might have 2 functions, partA() and partB();
the former
would produce the first form, the later the second. this is not exactly what i
would do, but it should give you the idea of splitting things up in your code.
Post by Janet N
Is there any way to use the "hidden" attribute of HTML variables to prevent
the output message from overwriting the page?
that will allow you to have fields that do not display visibly but can pass data
to and from the browser like the other form inputs. you cannot use this to
capture data from a second form on the same page. as far as i know, only
the form information of the form corresponding to the submit button that was
pressed will be sent to the server. if you have another form on the page, even
if it has data filled in, that data will not be sent to the server
when the submit
button of another form is pressed.
you can see a simple example here:
http://nathan.moxune.com/testForm.php?blah=sdfg

exactly what type of output message is overwriting the page?

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