[eluser]Unknown[/eluser]
I have a question regarding what i'm doing wrong in this instance. ive been trying for days to solve this issue of wanting to OO PHP, and i thought about using codeigniter but instead ive stuck with Object Orientated PHP.
SO number 1: i have a controller that is setting a function for querying a database. which is simple.
like this:
Code:
function getCurrentMessage($strMessage)
{
$DBA = new DBAccessor("localhost","root","root", "laserwatch");
$DBA->dbConnect();
$sql = mysql_query("SELECT `tableScrollingMessage`.`strMessage` AS `strMessage` FROM `tableScrollingMessage`");
while($row = mysql_fetch_assoc ($sql)) {
extract($row);
}
$DBA->dbClose();
return $strMessage;
}
function messageSaved($currentMessage)
{
$DBA = new DBAccessor("localhost","root","root", "laserwatch");
$sql = 'UPDATE `tableScrollingMessage` SET strMessage='.$currentMessage.';';
//Connect to the database and execute the query
$DBA->dbConnect();
$DBA->executeInsertQuery($sql);
$DBA->dbClose();
}
in the GUI i am creating an object of getCurrentMessage and i'm trying to input that one single field from a table in the database into a textfield so that i can get the message and update the message
Code:
<?php
include ('AdminController.php');
$mesg = new AdminController;
$mesg->getCurrentMessage($strMessage);
$mesg1 = new AdminController;
print_r($_POST);
$mesg = $_POST['strMessage'];
$mesg1->getCurrentMessage($strMessage);
?>
<html>
<head></head>
<body bgcolor="#898989">
<form id="adminMessage" name="adminMessage" method="post">
<input type=image src="images/setmessage.gif" alt="setmessage" method="post"/ >
<input type="text" name=strMessage size="95" maxlength="95" value="<?php $mesg; ?>" />
</form>
</body>
</html>
i'm a little stumpted as to why the message wont appear in the textbox and why the submit button isnt updating. i've dont this before and it worked fine