Jump to content

Recommended Posts

Hi, I've been pulling out my hair already.  Please can someone help me.

I' using Joomla and installed JCE Editor & DirectPHP to be able to use PHP & Javascript.  I don't know anything about Java.  I've created a dropdown form and then an onchange event is called so that if the value in the form is selected it calls the php.  This works fine (I got an example form w3schools).  The problem is I wanted to change the form to get the values form a table but it doesn't work.

Example I used:  http://www.w3schools.com/PHP/php_ajax_database.asp

The code I changed is just the part about the form:

<?php
$con = mysql_connect('localhost', 'root', '');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("metnet", $con);

$sql="SELECT * FROM newsletter";

$result = mysql_query($sql);

echo "<form method='post'>";
$dropdown = "<select name='users' onchange='showuser(this.value)'>";

while($row = mysql_fetch_assoc($result)) {
$dropdown .= "\r\n<option value='{$row['id']}'>{$row['name']}</option>";

}

$dropdown .= "\r\n</select>";
echo $dropdown;

?>

 

The result I get in my article:

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/239523-php-java-in-joomla/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.