Jump to content

PHP & Java in Joomla


wilna

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.