PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > php embeded in html after first submit html disappear
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
php embeded in html after first submit html disappear

Réponse
 
LinkBack Outils de la discussion
Vieux 30/01/2008, 05h51   #1
Janet N
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut php embeded in html after first submit html disappear

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>

  Réponse avec citation
Vieux 30/01/2008, 11h16   #2
Jochem Maas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] php embeded in html after first submit html disappear

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>
>

  Réponse avec citation
Vieux 31/01/2008, 01h04   #3
Janet N
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] php embeded in html after first submit html disappear

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>
> >

>
>


  Réponse avec citation
Vieux 31/01/2008, 01h30   #4
Jochem Maas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] php embeded in html after first submit html disappear

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>
>>>

>>

>

  Réponse avec citation
Vieux 31/01/2008, 02h09   #5
Janet N
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] php embeded in html after first submit html disappear

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>
> >>>
> >>

> >

>
>


  Réponse avec citation
Vieux 31/01/2008, 04h50   #6
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] php embeded in html after first submit html disappear

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
  Réponse avec citation
Vieux 01/02/2008, 02h38   #7
AlmostBob
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] php embeded in html after first submit html disappear

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



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h52.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,24127 seconds with 15 queries