View Full Version : Creating a simple form that displays field output on same page?

08-08-2007, 01:04 AM
Ok so I'm not really sure how asp works or if i even need it, but from reading online i think i do. All i want to do is create a simple form for a user to enter their name, submit, and their name is displayed on the same page above the field and submit button. But i want any user that does this, for their name to be added to the list. I would use something like this i think:

<form name="input" action="html_form_action.asp"
<input type="text" name="user">
<input type="submit" value="Submit">

And what i want it to look like is something like this, and this would be an example after a few people have used it:



after submitting their name, it goes beneath name#2 and so forth. I would imagine this would be pretty simple, if anyone can help me with this i would greatly appreciate it. Thanks.

08-08-2007, 03:32 AM
What are you going to use to store the names? This can be a database, a text file, an excel spreadsheet, or an xml file. Otherwise what you want will only work for the individual who is adding the names, and even then as soon as this person closes the page, that info is gone. No one else will see the names.

Let me know more specifics on how you plan to store the names and I can help you.

08-08-2007, 04:48 AM
perhaps using mysql, this is for my phpbb forum but i am using html for this. I have mysql and i assume that would work. Otherwise, whatever will get it to submit the person's name and have it save on the page inside a table for others to see will work.

08-08-2007, 02:12 PM
If you are going to use the phpbb forum software, you will be using MySQL. However, you will also be using PHP as your Server-Side language, not ASP.

To answer your question about how to create a form:


if request.form("FirstName") <> "" then reply = request.form("FirstName")
if request.form("LastName") <> "" then reply = reply & request.form("LastName")
response.write("Thanks for applying, " & reply & vbCrLf)

IN PHP (untested):

if (isset($_REQUEST["FirstName"]) { $reply = $_REQUEST["FirstName"]; }
if (isset($_REQUEST["LastName"]) { $reply += $_REQUEST["LastName"]; }

echo "Thanks for applying, ".reply;


<form method="post" action="myform.asp"> <!-- action may also be myform.php, depending on your Server Side language -->
First Name: <input type="text" name="FirstName" size="10" /><br />
Last Name: <input type="text" name="LastName" size="10" /><br />
<input type="submit" value="Submit" name="B1" />

Mod -- you may want to consider moving this thread over to PHP.

08-08-2007, 08:09 PM
Ty for the help. I don't spose a mod could move it? I'lll look, but most forums users can't move threads. So it looks like i have the code for phpbb, just need a sql table to be created and save the data i guess.


Parse error: parse error, unexpected '{' in /usr/www/snk/forums/tournament.php on line 21

I get that^^


that's what i did

08-08-2007, 10:06 PM
Since you are using that code, try:

if (isset($_REQUEST["FirstName"]) $reply = $_REQUEST["FirstName"];
if (isset($_REQUEST["LastName"]) $reply += $_REQUEST["LastName"];

echo "Thanks for applying, ".reply;

Notice no braces.

I'm a fairly novice PHP coder myself (but have lots of XP in ASP), that's why I said it was untested.

If the above doesn't work, you can also try

if (isset($_REQUEST["FirstName"]) {
$reply = $_REQUEST["FirstName"];
if (isset($_REQUEST["LastName"]) {
$reply += $_REQUEST["LastName"];

echo "Thanks for applying, ".reply;