473,499 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript and PHP/MySQL Question

I want to write a listbox sized to 8 rows - I want to show summaries
in this listbox and when an item is selected, below I want to show the
details of the summary - I can trap a javascript event for the listbox
but can I put PHP code into the javascript event? I need to grab the
details out of a MySQL database using PHP - so basically I'm asking
how can I get the details to update dynamically as the user clicks on
different listbox items?

Thanks...

Jul 16 '05 #1
2 3927

"Ralph Freshour" <ra***@primemail.com> wrote in message
news:ho********************************@4ax.com...
I want to write a listbox sized to 8 rows - I want to show summaries
in this listbox and when an item is selected, below I want to show the
details of the summary - I can trap a javascript event for the listbox
but can I put PHP code into the javascript event? I need to grab the
details out of a MySQL database using PHP - so basically I'm asking
how can I get the details to update dynamically as the user clicks on
different listbox items?
Any php in a .php page is executed on the server BEFORE the page is sent to
the browser, you can't fire php statements in javascript functions.

To execute php based on what the user selects on the form, you will have to
make a new page request from the server, with the variables in the current
form submitted via POST or GET, or appended to the URL (= GET method).

If you are prepared to place ALL the records in the database in javascript
arrays, you can use these arrays to generate new from elements in the page
using javascript alone. Obviously there are a few problems with this
solution, mainly HTML page size and security (exposing database information
unnecessarily).

Thanks...

Jul 16 '05 #2
Hi Ralph!
On Tue, 15 Jul 2003 03:10:44 GMT, Ralph Freshour <ra***@primemail.com>
wrote:
I want to write a listbox sized to 8 rows - I want to show summaries
in this listbox and when an item is selected, below I want to show the
details of the summary - I can trap a javascript event for the listbox
but can I put PHP code into the javascript event?
JavaScript clientside, PHP Serverside, ergo: You have to request a URL
(x.php) with JS. Pass all needed data through URL paramaters. This
will require a reload.
I need to grab the
details out of a MySQL database using PHP - so basically I'm asking
how can I get the details to update dynamically as the user clicks on
different listbox items?

HTH, Jochen
--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1442
by: Ronan | last post by:
Hi, I have a problem with a form using the PHP PEAR HTML_QuickForm package & javascript: I want to record the content of my form into a mySQL database then execute a javascript function. ...
2
5017
by: RootShell | last post by:
Hello First of all i know that PHP is a server side, and JavaScript is a Client side programming language, but i need to know if there is any way i can add the variable "countDownInterval" from...
4
1311
by: Cirene | last post by:
I have a simple screen: 1 question, 4 answers (A,B,C,D) The user clicks on a letter (answer) and it highlights the answer. (Javascript) When the use clicks NEXT I want PHP code to run and...
1
2935
by: mike | last post by:
I'm fairly green with javascript, and have been looking everywhere for an example of how to load data from a mysql db into javascript arrays. For a little background on what I'm trying to do, any...
4
1967
by: linusthefish | last post by:
Is it possible to use JavaScript & MySQL? What I'm looking to do is query a database and then output the results in a popup window. I've got the popup window part down, I just can't figure out...
1
4794
by: Satish.Talyan | last post by:
hi, i want to create a dynamic tree hierarchy in javascript.there are two parts in tree, group & user.when we click on group then users come under that's tree category will be opened.problem is...
27
4677
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
4
2550
by: Nate12o6 | last post by:
Mabee you guys can help me with this. I have a form with enctype="multipart/form-data" that has a textarea in it as well as file upload. The text area is for a description of the file. If...
4
2106
by: wish | last post by:
<head> <script type="text/javascript"> function delete_confirm() { var r=confirm("Are you sure you want to delete this record?") if (r==true) { <!--start to link to mysql to delete the...
0
7134
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
7180
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
7225
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6901
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
7392
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
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3105
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.