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>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php