Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-17-2011, 01:47 AM   PM User | #1
ttzary
New to the CF scene

 
Join Date: Feb 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ttzary is an unknown quantity at this point
Exclamation Form and Results on same page, along with a echo.

Okay... I am trying to make a simple php page. All I want it to do, is for the user to enter his/ her name, and a php script echos the name out to the same page. The form would be submitted, then the form would switch places (disappear) and the echo would print the name. It would be nice to see the name appear on every page I place the code on. It would also be even better if the page prompts the user for their name, then it appears on every page I place the code on.
ttzary is offline   Reply With Quote
Old 02-17-2011, 02:52 AM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
The first part of your problem is shockingly similar to the example in the introductory tutorial found at php.net.

http://us3.php.net/manual/en/tutorial.forms.php

Retaining information from page to page is a bit more involved so you should proabably tackle the basics first.
__________________
Fumigator is offline   Reply With Quote
Old 02-17-2011, 03:46 AM   PM User | #3
ttzary
New to the CF scene

 
Join Date: Feb 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ttzary is an unknown quantity at this point
Exclamation So?

So how to I do I do it then?
ttzary is offline   Reply With Quote
Old 02-17-2011, 05:59 AM   PM User | #4
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Surely you clicked on that link I gave you.
__________________
Fumigator is offline   Reply With Quote
Old 02-17-2011, 07:34 AM   PM User | #5
ankifreeze
New Coder

 
Join Date: Dec 2010
Posts: 62
Thanks: 2
Thanked 0 Times in 0 Posts
ankifreeze is an unknown quantity at this point
maybe like this
PHP Code:
<?php


if(!empty($_POST['name'])){
echo 
$_POST['name'];}else{echo"<form method='post' action=''>name:<input type='text' name='name'><input type='submit' name='submit' value='submit'></form>";}
?>
i
ankifreeze is offline   Reply With Quote
Reply

Bookmarks

Tags
echo, form, page, php, treyzwebsite

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:31 AM.


Advertisement
Log in to turn off these ads.