How to post text submited in a form.

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 2
Joined: Wed Feb 26, 2003 6:13 am

How to post text submited in a form.

Postby oilytheotter » Wed Feb 26, 2003 6:16 am

I know having users requires a database, but if I just wanted a page where a sentence or two could be entered, then automaticaly posted to the site, how would I do that?

New php-forum User
New php-forum User
Posts: 32
Joined: Tue Jan 28, 2003 10:19 am
Location: Québec

Postby border20 » Wed Feb 26, 2003 6:54 am

You can just put a submit button, and from there, the text is passed to the next page as a variable with the same name as your text box

Code: Select all

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Name: <input type="text" name="name" size="20"></p>
<Input type='submit' name = 'submit' value = 'Submit'>

If ($_POST['submit']){
echo $_POST['name'];

edited by Redcircle

something like this should do
but i'm still a newb :)
hope it helps

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Wed Feb 26, 2003 7:44 am

don forget to turn gerister_globals=on

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests