Solved

help with input area

Posted on 2003-11-03
4
250 Views
Last Modified: 2013-12-13
Ok hi :)

i just wana know is it posible an exsample would not be harm :).

ok i have this input box and i need something like this, when this box change "onchange" its calls out php function wich will do something for exsample:

function world() {
       print("hellow world");
      }

.....

input type="text" name="world" onchange="world()"

.....
my exsample doesn't work :)


thx.
0
Comment
Question by:Kristao
4 Comments
 

Expert Comment

by:php_user
ID: 9673367
Sorry, you are out of luck.
JavaScript is on the client side, PHP is on the server side. You will need to write a JavaScript function to emulate whatever the php function does.

0
 
LVL 1

Expert Comment

by:rstorey2079
ID: 9683546
If you absolutely need to get Javascript to trigger something in PHP, you have a few options, none of which are pretty:

- open a popup window (could be blocked, you could make it visible, or make it very very small)
- open a pop-under window (virtually invisible but could be blocked)
- use a hidden frame

any of these sound good?  if not, just make a new request to the server, do whatever you need to do, and bring the user back to the page she was on.   if you need to maintain some variables you can just pass them along in PHP...

hope that helps.
0
 
LVL 3

Accepted Solution

by:
red010knight earned 50 total points
ID: 9686582
Well the simplest thing to do would first:
input type="text" name="world" onchange="javascript:world()"

and create a spot on your page -preferably a text box as to keep things simple.
<input type="textbox" name="datadisplay" value="">

second:
insert this at the top of your page
<script language="javascript">
function world(){
  document.datadisplay.value="Hello world!"
}

This should get your desired affect - if you have a better example of what you are trying to do, it would help to better illustrate what you need and point to some preexisting javascript code that you could use.

Hope this helps,
Red010Knight
0
 
LVL 1

Author Comment

by:Kristao
ID: 9915933
sorry about this long time no answer :) but i dindn't get notice to my e-mail
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now