Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Populating Text Box with PHP
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Phenomena




PostPosted: Sun Mar 11, 2007 12:58 am   Post subject: Populating Text Box with PHP

Ok I'm fairly new to php and would really like to learn it Razz For my first project I want to create an xml plugin creator (because im lazy too make them by hand Razz) So what I would be doing is creating an html textbox labeled name and a submit button. When I hit submit I need it to add whats in the text box to a different textbox without overwritting anything so that i can go back up change whats in the textbox hit submit again and have it added to the list while keeping everything else. Sorry if this confusing its late and Im tired. >_<
Sponsor
Sponsor
Sponsor
sponsor
morgaine




PostPosted: Sun Mar 11, 2007 2:52 am   Post subject: RE:Populating Text Box with PHP

for appending the value of one text box to another, you really don't need a server-side language, JavaScript is the easiest way to go.

That said, here's what you can do in php: (copy and paste the following into a file called sample.php to test it out)

<html>
<body>
<?php $_GET['list'].=($_GET['list']=='' ? $_GET['name']:"\n".$_GET['name']) ?>

<form action="sample.php" method="get">
Name: <input type='text' name='name' />
<input type='submit' value='submit' /><br />
<textarea name='list'>
<?php echo $_GET['list'] ?>
</textarea>
</form>

</body>
</html>
samara




PostPosted: Tue Jun 02, 2009 11:16 am   Post subject: Re: RE:Populating Text Box with PHP

morgaine @ Sun Mar 11, 2007 2:52 am wrote:
for appending the value of one text box to another, you really don't need a server-side language, JavaScript is the easiest way to go.

That said, here's what you can do in php: (copy and paste the following into a file called sample.php to test it out)

<html>
<body>
<?php $_GET['list'].=($_GET['list']=='' ? $_GET['name']:"\n".$_GET['name']) ?>

<form action="sample.php" method="get">
Name: <input type='text' name='name' />
<input type='submit' value='submit' /><br />
<textarea name='list'>
<?php echo $_GET['list'] ?>
</textarea>
</form>

</body>
</html>


Hello Morgaine this code was very helpful for me!!

but when i am opening the sample.php over the web, i am getting 3 errors:

1,) at line 3 (<?php $_GET['list'].=($_GET['list']=='' ? $_GET['name']:"\n".$_GET['name']) ?> ) "Undefined Index List on line 3"

2.) Undefined index name on line 3

3.) undefined index list on line 3

what should i do?
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: