Hey gang,
I have a small app that displays the contents of a MySQL database table, and am trying to get a form at the top to work...
Here is what I have - the app works fine, if the database info is input directly into the file,.. in an array like this:
"database" => array("host" => "localhost",
"username" => "user1",
"password" => "mypassword",
"database" => "test_db",
"table" => "myTable"),
"sortable" => "all",
"editable" => "all",
.....
Table data is output here
.....
What I am trying to do is use a form, at the top of the same page that renders this data, to update the array items.. so, maybe the array would look something like this:
"database" => array("host" => $_POST['host'],
"username" => $_POST['user_name'],
"password" => $_POST['password'],
"database" => $_POST['database'],
"table" => $_POST['table']),
"sortable" => "all",
"editable" => "all",
.......
table data is output here
.......
and my form at the top of the page looks like this:
<form method="POST" action="index2.php">
<label>Host:</label>
<input type="text" name="host" id="host" value="" size="30" maxlength="10" />
<label>Username:</label>
<input type="text" name="user_name" id="user_name" value="" size="30" maxlength="10" />
<label>Password:</label>
<input type="text" name="password" id="password" value="" size="30" maxlength="10" />
<label>DB Name:</label>
<input type="text" name="database" id="database" value="" size="30" maxlength="10" />
<label>Table:</label>
<input type="text" name="table" id="table" value="" size="30" maxlength="10" />
<input type="submit" value="submit" />
</form>
I'm no JS wiz, but I presume that AJAX might be a way to go when updating variables without leaving the page or sending the data to another page...
Any help is greatly appreciated !!
Thanks again!