Re: php embeded in html after first submit html disappear

From: Date: Thu, 31 Jan 2008 01:30:49 +0000
Subject: Re: php embeded in html after first submit html disappear
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-268399@lists.php.net to get a copy of this message
Janet N schreef:
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.
Thanks. On Jan 30, 2008 3:16 AM, Jochem Maas <jochem@iamjochem.com> wrote:
Janet N schreef:
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:
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
<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>


« previous php.general (#268399) next »