Forums

PHP issue with chronoforms

kgkekas 17 Jun, 2010
Hey all
Firstly, let me say that im loving chronoforms up to this point :-) good work on an excellent app ...
Im currently trying to create a form in joomla 1.5.12 using the most current install of chronoforms ...
The login page includes some php script which drags usernames from an SQL database and fills the dropbox so that users in the database along can login ...

the problem I have is that as soon as include the php script, the form does not appear on the page .. no errors, nothing ...
I have tested this locally using joomla 1.5.18 and it worked perfectly fine ....

here is the code which displays the form:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SOS REGISTERS LOGIN</title>
<style type="text/css">
<!--
#header {
    font-size: x-large;
    font-weight: bold;
    color: #000080;
    font-family: Arial, Helvetica, sans-serif;
}
#bodylogin div p {
    font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
</head>
<body>
<div id="header" align="center">SOS REGISTERS</div>

<div id="bodylogin">
  <div align="center">
    <p>Select your name from the list below:
    </p>
    <form id="login" name="Login User" method="post" action="">
      <p>
        <select name="user login" id="user login">
          <?php
do {  
?>
          <option value="<?php echo $row_users['username']?>"<?php if (!(strcmp($row_users['username'], $row_users['username']))) {echo "selected=\"selected\"";} ?>><?php echo $row_users['username']?></option>
          <?php
} while ($row_users = mysql_fetch_assoc($users));
  $rows = mysql_num_rows($users);
  if($rows > 0) {
      mysql_data_seek($users, 0);
      $row_users = mysql_fetch_assoc($users);
  }
?>
        </select>
      </p>
      <p>
        <input type="submit" name="login" id="login2" value="Login to Registers" />
      </p>
    </form>
    <p>If you cannot find your name in the list above, please see your TM.</p>
  </div>
</div>
<p>
</p>
</body>
</html>


and here is what kills it
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname = "******"
$database = "*******";
$tblname = "users";
$username = "*******";
$password = "*******";
$users = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR); 
?>


<?php
mysql_select_db($database, $users);
$query = "SELECT username FROM users";
$users = mysql_query($query, $users) or die(mysql_error());
$row = mysql_fetch_assoc($users);
$totalRows = mysql_num_rows($users);
?>


<?php
mysql_free_result($users);
?>


any help would be appreciated
Max_admin 18 Jun, 2010
Hi,

Can you please explain why are you trying to do this ?

you are using a punch of wrong tags in your form code, including DOCTYPE, FORM, HEAD tags and other stuff, the form code should be only whatever code "between" the 2 <form </form> tags

Your PHP code should not be used here as well because it will probably make problems, you should use the Joomla database classes and functions to load the data from the database, I think that one line there is causing this problem

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.