PHP Script

Status
Not open for further replies.

Yek

T.F's Resident Cool Guy...
Messages
1,613
Hi, im hoping someone can help me out.

I need a script that contains a textbox and submit button, the script takes the info entered into the textbox and outputs it in a html page. Im hoping this wont take a good web designer too long and i would be very greatful :) (iv searched through google and was suprised not to find anything!)

THANK YOU!
 
I can help.

What exactly are you looking to do? Are you trying to make a comments page?
 
i think he means like a shout out box? where people input a message and it appears above
 
Well for comments or a shout box you'll want to have a MySQL database. Do you have access to this?
 
Yes (but i dont think it would be needed)

The security of this script is n/a.

i need a form that outputs the data entered into it on another page (prefrebly in a text area) and thats it just input and output ;)
 
a MySQL database will be needed. The PHP script will write the info that you entered into the MySQL database, and then the other page will read it.

Unless you only want the text to be on the page temporarily, a MySQL database is the easiest way.
 
Here's something that I wrote in a minute or so but I am pretty hammered at the moment but it works just fine...Don't know if it's what you're asking for but here you go.

test.php
PHP:
<?php
	if ($_POST['var']) {
	header("Location: test2.php?text={$_POST['var']}");
}
?>
<html>
<body>
<form method='POST' action='test.php'>
<textarea rows='5' name='var' >
</textarea>

<p>
<input type='submit' name="submit"  value='submit'>
</form>
</body>
</html>

test2.php

PHP:
<?php
	if ($_GET['text']) {
		echo($_GET['text']);
}
?>

Like I said I wasn't quite clear what you were asking for but here you go :)
 
Thanks, im getting an error however:

Warning: Header may not contain more than a single header, new line detected. in /home/___________/test.php on line 3

Any ideas?
Thanks alot.
 
So that's what you want?

Try this:

form.php
PHP:
<form action="display.php" method="post">
<textarea cols="20" rows="5" wrap name="text"></textarea>
<br />
<input type="submit" name="submit" value="Submit" />
</form>

display.php
PHP:
<?php
if (isset ($_POST['submit'])) {
	print $_POST['text'];
}
?>

It will only stay there until you close the browser, though, so I'm not sure of what use that is to you.
 
Status
Not open for further replies.
Back
Top Bottom