maciek4 Posted March 31, 2006 Share Posted March 31, 2006 [quote]I want to gather information from the user and display it on another page.In the file commit.php I have 2 fieldsProduct name:Description:[code]<TR><TD ALIGN="right" VALIGN="middle" width="40%"> Product name: </TD> <TD ALIGN="right" valign="middle"><input name="name" size="27" type="text"></TD> </TR> <TR><TD ALIGN="right" VALIGN="middle">Description: </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: </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: </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] Quote Link to comment Share on other sites More sharing options...
bqallover Posted March 31, 2006 Share Posted March 31, 2006 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 Link to comment Share on other sites More sharing options...
maciek4 Posted April 3, 2006 Author Share Posted April 3, 2006 [!--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"> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.