Solved

How to ouput form information on same (form) page?

Posted on 2004-04-22
6
261 Views
Last Modified: 2008-03-06
Hello,

I am wondering if (then how) it is possible to output data received from a form on the same page as form, and also to for every new input in the form, to lineup the datas below each other.

What I am trying to say is that I would like the site to have the functionality as a "Guest book-site" or as a "Forum"  where the visitor can just leave a message and see what others before them have written.

Ex:
*****************************************************
echo "<form action='thispage.php' method='post'>":
//some input fields     ...<input .....name=subject> ....
//.....<input.....name=message> .....
// ...etc ...
echo "</form>";

// here the information inputed in the form should be output ::
$subj = $_POST["subject"];
$msg = $_POST["message"];
etc....

*****************************************************
So, for every new entry in the form (by same or different user) the inputed data should be outputed just below the form.
And so is should lineup every new entry below each other, without overwriting the previous data !!

And I don't want to wirte the form data down to file and then read the data back to the site for every entry because that would be unneccesary .....I think

I hope you got what I meant..
0
Comment
Question by:Hannibal_L
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Accepted Solution

by:
chrgary earned 43 total points
ID: 10887754
I think I understand what you mean, and this would be possible for each individual user to see their own comments using cookies or sessions perhaps, but other visitors that visit the page will not be able to see the comments of other visitors without them being written to a database or text file.  The only variables that everyone can see are $_server and $_env variables, which unfortunately only the webserver and php namespace write to.

Your best bet would probably be to store them in a database, since having a textfile marked as readable and writable might compromise the security since you have to set that file as readable and writable on your webserver, unless you place it outside of the webroot directory.
0
 
LVL 6

Assisted Solution

by:carchitect
carchitect earned 41 total points
ID: 10887762
simple either use some file handling ......

//Form Code
<Any data submitted to form shud be appeneded to the file>
//Form closed

//Display file

It is just like this page (experts exchnage)

or use some database...submit data in it ....and display after form...like forums
0
 

Assisted Solution

by:Uzaree
Uzaree earned 41 total points
ID: 10922501
All you need to do is remove the

"<form action='thispage.php' method='post'>

and change it to

"<form action='' method='post'>

that will cause the form to post to itself

so now you would have

Ex:
*****************************************************
echo "<form name='form' method='post'>":
//some input fields     ...<input .....name=subject> ....
//.....<input.....name=message> .....
// ...etc ...
echo "</form>";

// here the information inputed in the form should be output ::
$subj = $_POST["subject"];
$msg = $_POST["message"];

print $subj;
print $msg;

etc....

*****************************************************
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Extracting content from meta tag PHP MYHTML DOM 3 35
issue with DB import 1 36
PHP SMTP authentication 6 24
Displaying a google org chart from php/mysql code 27 15
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question