Jump to content

displaying info from form on a different page


maciek4

Recommended Posts

[quote]I want to gather information from the user and display it on another page.

In the file commit.php I have 2 fields

Product name:
Description:

[code]
<TR><TD ALIGN="right" VALIGN="middle" width="40%"> Product name:&nbsp;
</TD>
<TD ALIGN="right" valign="middle"><input name="name" size="27" type="text"></TD>
</TR>
<TR><TD ALIGN="right" VALIGN="middle">Description:&nbsp;</TD>
   <TD ALIGN="right">  <textarea name="desc" rows="5"></textarea>
   </TD>
   </TR>
[/code]

And in the file add_new.php I want to display whatever text user wrote in those two fields Product name and description.

[code]
<?php
                    
if (isset ($_POST['name']) || isset ($_POST['desc']))
   {
   echo'<form action="add_new.php" method="POST" name="submit">
   <TR><TD ALIGN="right" VALIGN="middle" width="40%"> Product name:&nbsp;
</TD>
<TD ALIGN="right" valign="middle"><input name="name" size="27" type="text" value="'.$_POST['name'].'"></TD>
</TR>
<TR><TD ALIGN="right" VALIGN="middle">Description:&nbsp;</TD>
   <TD ALIGN="right"><textarea name="desc" rows="5" value="'.$_POST['desc'].'"></textarea>
   </TD>
   </TR>
   </form>';
}
?>  
[/code]

Unfortunatelly nothing is displayed althought there are no errors.[/quote]
Link to comment
Share on other sites

What's in your <form> tag? Is its action pointing to the right file and the method set as POST? Also might be useful to check the source of the page that gets returned. That way you'd know if it's just your $_POST variables not being output, or the whole thing, or parts of it.

For something like this, I'd more likely use HereDoc syntax:

echo <<<END
[i]... HTML with variable interpolation ...[/i]
END;

but it's just a matter of preference. :)
Link to comment
Share on other sites

[!--quoteo(post=360482:date=Mar 31 2006, 11:51 PM:name=bqallover)--][div class=\'quotetop\']QUOTE(bqallover @ Mar 31 2006, 11:51 PM) [snapback]360482[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What's in your <form> tag? Is its action pointing to the right file and the method set as POST? Also might be useful to check the source of the page that gets returned. That way you'd know if it's just your $_POST variables not being output, or the whole thing, or parts of it.

For something like this, I'd more likely use HereDoc syntax:

echo <<<END
[i]... HTML with variable interpolation ...[/i]
END;

but it's just a matter of preference. :)
[/quote]

<form action="add_new.php" method="POST" name="submit">
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.