|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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> |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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> > |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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. 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> > > > > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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> >>> >> > |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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? On Jan 30, 2008 5:30 PM, Jochem Maas <jochem@iamjochem.com> wrote: > 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> > >>> > >> > > > > |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On Jan 30, 2008 9:09 PM, Janet N <janet9k@gmail.com> wrote:
> 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. > 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 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Am reading and learning (reading fast, learning slow) can make php process
three forms consecutively if I get the syntax right for the forms Something like <?php if (!isset(condition1) ) { echo "<form action=$_SERVER['PHP_SELF'] method='post'> stuff to create form 1 validation etc" } elseif (!isset(condition2)) {echo "<form action=$_SERVER['PHP_SELF'] method='post'> stuff to create form 2 ditto" } else {echo "<form action=$_SERVER['PHP_SELF'] method='post'> stuff to create form 3 ditto" } ?> -- If at first you dont succeed try try try again If at first you do succeed try not to look surprised _ ""Nathan Nobbe"" <quickshiftin@gmail.com> wrote in message news:7dd2dc0b0801302050q12afb5e3ra0a0eb930e3b1d06@ mail.gmail.com... > On Jan 30, 2008 9:09 PM, Janet N <janet9k@gmail.com> wrote: > > 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. > > > 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 |
|
![]() |
| Outils de la discussion | |
|
|