Jump to content

getting user input and submitting on one page


mikeym

Recommended Posts

Hi,

 

I'm trying to make a series of pages that I want users to be able to select to make a comment, have a comment box open, type their comment and submit it to be shown their new comment on the same page.

 

Is this possible using php and how do I go about organising it? I want to have my pages as html with <?php whatever ?> tags in them so that the basic page is kept as simple as possible.

 

My first attempt will let me click on a new comment button which will open a box to add a comment (as long as you're logged in) - this is using a html parameter to tell it to show the box called from the link - but I have no idea how to then submit the form and open up the same page.

 

The test page for this is very scrappy so I apologise but it can be found at:http://www.getoutofglasgow.com/test/index.htm

 

Log on as "tester" with the password "test" to see how it's working so far.

 

 

Link to comment
Share on other sites

This what you are talking about? 

 

<?

if ($_POST['submit']) {

       echo $_POST[comment];

} else {

?>

<form enctype="multipart/form-data" action="" method="post">

Comment:<textarea name="comment" cols="40" rows="10" style="overflow: auto"></textarea>

<input type="submit" name="submit" value="Submit"  />

</form>

<? } ?>

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.