473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Printing AIML response in a textarea in PHP

Hi,

This is my first post. I am currently learning PHP and am trying to combine it with AIML in order to create a chatbot that prints its replies into a textarea.(named "Answerfield")

At the moment, I only know how to print the output within a new Internet Explorer or Firefox windows.

I am looking for a way to edit the PRINT command so that the output can appear in the textarea but no luck so far. Any ideas would be really welcome.

Here is my PHP code:

[PHP]

if (isset($HTTP_POST_VARS['input'])){

$numselects=0;

// Start the session or get the existing session.

session_start();
$myuniqueid=session_id();

// Here is where we get the reply.

$botresponse=replybotname($HTTP_POST_VARS['input'],$myuniqueid,$HTTP_POST_VARS['botname']);

// Print the chatbot response

print "<B>ANSWER : " . $botresponse->response . "<BR></b>";


?>

<html>
<head>
<body bgcolor="gold" text="#000000">
<title>Feedback</title>
</head></body></html>

<? [/PHP]


Thanks in advance
Jan 21 '07 #1
4 2112
ronverdonk
4,258 Expert 4TB
You want to print the data in your textarea. What textarea? There is no textarea in your code. Please show us.

Ronald :cool:
Jan 21 '07 #2
Thanks a lot for your reply and my apologies for the delay, I couldn't log back in to the site.
Here is the code with showing the textarea.
There must be a way to tell PHP to print within the textarea declared as "Answerfield" at the bottom of the page. I am learning php at the moment and have very little experience :

[PHP]if (isset($HTTP_POST_VARS['input'])){
$numselects=0;
$myuniqueid=session_id();

$botresponse=replybotname($HTTP_POST_VARS['input'],$myuniqueid,$HTTP_POST_VARS['botname']);

print "<B>ANSWER : " . $botresponse->response . "<BR></b>"?>

<html>
<head>
<body bgcolor="lightblue" text="#000000">
<title>Feedback</title>
</head></body></html>

<form name="form1" method="post" action="talk.php">

<select name="botname">
<?
foreach ($availbots as $onebot){
print "<option value=\"$onebot\">$onebot</option>";
}
?>
</select><BR>

Type your question here: <input type="text" name="input" size="54">

<input type="submit" name="Submit" value="Submit">
</form>

<form>
Answer: <textarea name="Answerfield" cols="60"></textarea>
<input type="submit" name="GoToNextLecture" value="Next Lecture">
</form>

</body>
</html>

<?

}

?>[/PHP]

Thank you in advance, Any help is greatly appreciated
Feb 16 '07 #3
ronverdonk
4,258 Expert 4TB
Just echo the PHP variable (e.g. $mytext) you want to show in the textarea, like this:

[php]
Answer: <textarea name="Answerfield" cols="60"><?php echo $mytext; ?></textarea>
[/php]

Ronald :cool:
Feb 16 '07 #4
Just echo the PHP variable (e.g. $mytext) you want to show in the textarea, like this:

[php]
Answer: <textarea name="Answerfield" cols="60"><?php echo $mytext; ?></textarea>
[/php]

Ronald :cool:

Thanks a million for your reply Ronald!! I really appreciate your valuable advice! Im gonna give this shot and will let you know how I get on!
Feb 23 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: ravN | last post by:
Hi all. I'm writting a nautural language analyzer application with ai elements and I don't want to use the Prolog to take the ai part. I found that AIML would be a great solution but I don't...
4
by: google | last post by:
I would like to print a table, using a while loop to insert as many blank text fields as players specified by the user. How do I put html inside a php loop. This is what I have.... <body>...
13
by: TinyTim | last post by:
I'm a newbie at ASP & HTML. It seems that when you use server side code and you're going to return a customized HTML form with several fields and labels, you have to do an extensive amount of...
2
by: Stephan Bour | last post by:
I have a vexing problem I hope someone can help me with: I have an ASP.Net site that allows users to place orders for biological materials. Once the order is done though, I would like to have two...
2
by: DShadow | last post by:
Hi this is my first post and i have a question about php. I want to print a variable from textarea and print it in php but when i do all te returns are turned in to spaces. I have used wrap"hard"...
0
by: Boris Ozegovic | last post by:
Hi I have a chatterbot written in AIML. I am using PyAIML, and HTTP server as a mediator between user and PyAIML. Server calls PyAIML, and sends the result string to the sensor network which...
0
by: Germaris | last post by:
Hi there! I implemented a printing function which is working nice even for multiple pages. Problem is as follows... Say we have a text 100 lines long. Each page can hold 80 lines. We should...
3
by: Toni | last post by:
I want users to submit text in a textarea form, and the information is submitted one line at a time. When they submit the form, it will go to an ASP script. How do I parse the textarea form...
4
by: samslists | last post by:
Hi... I've seen code which changes a paragraph into a textarea (to allow it to be edited)...by creating a brand new text area, inserting that into the dom at the right place, and deleting the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.