Web Development

HTML help – evdude

evdude

Member

Posts: 135
From: Earth Orbit
Registered: 03-14-2007
I'm trying to make a web page that some one can enter text into a text box and submit it, and then the page will then have that person's message on it.

can some one tell me how to do this?

------------------
"trust in the lord with all your heart and lean not on your own understanding, in all your way's, acknowledge him and he will direct your path" proverbs 3:5-6

Jari

Member

Posts: 1471
From: Helsinki, Finland
Registered: 03-11-2005
Hi, sounds like you need forms. This page shows how to use them: http://www.w3schools.com/html/html_forms.asp

check the part where it shows "The Form's Action Attribute and the Submit Button"

I hope that helps and please tell if you have any problems.

------------------
Psa 32:5 I acknowledged my sin unto thee, and mine iniquity have I not hid. I said, I will confess my transgressions unto the LORD; and thou forgavest the iniquity of my sin. Selah.

[VoHW] (Help needed) [Blog] - Truedisciple (mp3)

tehriddler

Junior Member

Posts: 8
From: Portland, Oregon
Registered: 05-07-2007
evdude,

I remember back when I was curious about your same question. This is how I got into PHP.
As far as I know, PHP is the only language I know about that is able to handle form submit information. But before you can do this, you will most likely need a webserver capable of handling PHP. If you do not have access to one, I would suggest downloading and installing: WAMP5

What you'll need to do is:

In your form tags, have the action point to the php page that will be recieving the comments. You will need to also have the method as post.

Example:
(in an page with a .html extention)
<form action="anyphppage.php" method="post"></form>

After that, the receiving page (with a .php extention) will need to be set up to recieve the 'posted' form data.

I'm sorry that I do not have to time to fully delve into this process right now, but if you'd like, I'd suggest checking out this tutorial on Forms and PHP.

Best of luck on your project!

God Bless!
-Teh Riddler

[This message has been edited by tehriddler (edited May 19, 2007).]

MastaLlama

Member

Posts: 671
From: Houston, TX USA
Registered: 08-10-2005
You can do it in PHP, ASP, ColdFusion...all kinds of different ways. You could even use Client-Side JavaScript if you don't want to get out of HTML and into a web programming language (not that Javascript isn't...it's just not as powerful).
MastaLlama

Member

Posts: 671
From: Houston, TX USA
Registered: 08-10-2005
here's an example of how to do it with just Javascript...doesn't save the info...


<html>
<head>
<title>Display Text</title>
<script>
function displayText(){
document.getElementById("pageBody").innerHTML = document.form1.text.value;
}
</script>
</head>

<body>
<p id="pageBody">
<form method="get" action="" id="form1" name="form1">
<table border="0">
<tr>
<td>
Enter the text:
</td>
</tr>
<tr>
<td>
<textarea cols="50" rows="10" name="text" id="text"></textarea>
</td>
</tr>
<tr>
<td align="right">
<input type="button" name="button" value="Display Text" onClick="displayText();">
</td>
</tr>
</table>
</form>
</p>
</body>
</html>

There's some cool stuff you can do there...for example paste the following into the box, click the "Display Text" button then use the new form:


<form method=get action=http://www.google.com/search>

<input maxlength=2048 name=q size=55 title="Google Search" value="">
<br>
<input name=btnG type=submit value="Google Search">
<input name=btnI type=submit value="I'm Feeling Lucky">

</form>

[This message has been edited by mastallama (edited May 20, 2007).]

MastaLlama

Member

Posts: 671
From: Houston, TX USA
Registered: 08-10-2005
Also, you'll get different results with different browsers...IE will make the original form disappear, FF will write your new stuff above the form.
evdude

Member

Posts: 135
From: Earth Orbit
Registered: 03-14-2007
Thanks for the replys. I think could make a form, I just need to know how to make a php or ASP thing edit the html document so the input is always there.

------------------
"trust in the lord with all your heart and lean not on your own understanding, in all your way's, acknowledge him and he will direct your path" proverbs 3:5-6

MastaLlama

Member

Posts: 671
From: Houston, TX USA
Registered: 08-10-2005
You really don't want it to edit the HTML, you'll want to use a database. If you're using a Windows Server with IIS4 or higher you can use an Access database with ASP no problem. If you just want to do this for testing at home you could run Personal Web Server if you can find an old copy of it somewhere on the web.

If you're serious about learning ASP there's a site that really helped me when I was starting out: http://www.ASP101.com

Specific samples that may help you:
Connecting to an Access Database

Adding records to an Access Database

Deleting records in an Access Database

Updating records in an Access Database

Counting records in an Access Database

Bring it all together to view/edit/delete in an little interface.

There's tons of other things you can do but if you're looking at using a database (not just Access - although your connection string would have to change a bit) this is a great place to start.

evdude

Member

Posts: 135
From: Earth Orbit
Registered: 03-14-2007
Ok, I'd use ASP but I don't know if googlepages will let me use it.
Is there a way to write to xml with javascript?

------------------
dudey calls...

"trust in the lord with all your heart and lean not on your own understanding, in all your way's, acknowledge him and he will direct your path" proverbs 3:5-6

samw3

Member

Posts: 542
From: Toccoa, GA, USA
Registered: 08-15-2006
It seems googlepages doesn't even support javascript that well.

http://www.google.com/support/pages/bin/answer.py?answer=35213

------------------
Sam Washburn

Check out my CCN SpeedGame 2 Blog

MastaLlama

Member

Posts: 671
From: Houston, TX USA
Registered: 08-10-2005
What are you trying to do? I could host a page for you on my website if you need me to.
evdude

Member

Posts: 135
From: Earth Orbit
Registered: 03-14-2007
@samw3: I'm using my own HTML files, and just putting a link to them in the in main page. I tried using javascript in one of those and it worked.
if it doesn't for editing xml I can make a gadget(which can have javascript) and use that.

@mastallama: its a form to comunicate with a friend about the development of a game that I'm making for him and my brother.

------------------
dudey calls...

"trust in the lord with all your heart and lean not on your own understanding, in all your way's, acknowledge him and he will direct your path" proverbs 3:5-6

[This message has been edited by evdude (edited August 23, 2007).]

evdude

Member

Posts: 135
From: Earth Orbit
Registered: 03-14-2007
Ok, I figured it out.

------------------
dudey calls...

"trust in the lord with all your heart and lean not on your own understanding, in all your way's, acknowledge him and he will direct your path" proverbs 3:5-6