Hi Lawfour
Ok the first thing is I think your ready to move on to hand-writing your php instead of using a tool to do it for you. The people in this form are great and we can answer almost any question you have. -And while writing by hand might take a while at first you will eventually generate many methods and algorithms that you will re-use over and over so things will eventually become less frustrating.
Ok, here is how you will need to do form submission for now on. The mail() method simply wont work.
Make a form like this
[HTML]
onetwothree
[/HTML]
Notice that the submit button is not a type="submit". We are going to call a javascript function called validate first before we potentially send off bad info to the php page. the function looks like this
function validate() {
fm = document.thisForm
//use validation here to make sure the user entered
//the information correctly
fm.submit()
}
Notice that the form has an action="process.php". That means that there will be $_POST variables available to you in that php file. When the user hits the submit button and the javascript sends the form, the browser will re-direct to process.php
Here's what that page might look like
[PHP]<?php
echo $_POST['my_textbox'];
echo $_POST['my_dropdown'];
//The name of these post variables is the same as the name
//of the elements that were in the form
?>[/PHP]
Now, Let me know if your have grasped all that and if you respond (in otherwords if you have looked back on this thread which some people dont even do). Then perhaps Troy and I can help you with the database and dynamic form part
On a side note. If you would have used method="GET" in the form, you would use $_GET[] in the php
-B
bwest
Junior Poster in Training
57 posts since Jul 2004
Reputation Points: 14
Solved Threads: 1
The javascript typically goes between the tags at the top of the page.
Here is a basic db connection class
[PHP]<?
class MyOps {
/* Global Variables */
var $conn = "localhost";
var $user = "db_username";
var $pass = "password";
var $db = "database_name";
/*****************dbconnect()***************************
* dbconnect() will remotely connect to a database *
* with a set of specified arguments. *
* *
* @conn = IP Address of the remote/local database *
* @user = DB Username *
* @pass = DB Password *
* @db = DB Name *
* *
*******************************************************/
function dbconnect() {
$link = mysql_connect($this->conn, $this->user, $this->pass, $this->db) or die("Could not connect : " . mysql_error());
$db_select = mysql_select_db($this->db) or die("error");
return $link;
}
}
?>[/PHP]
Then you import this file and use it like this in other php files that connect to the database
[PHP]
include ("db_scripts/dbconnect.php");
$dbops = New MyOps;
$link = $dbops->dbconnect();[/PHP]
Your overall page will look something like this
==============================start page
<?
//database connection
//query table names
//make a string of table names like this
$list = "ab";
?>
(javascript validation)
<?php echo $list; ?>
bwest
Junior Poster in Training
57 posts since Jul 2004
Reputation Points: 14
Solved Threads: 1
There really is almost all the code here in this thread that you would need. You just will need to implement your html and do the query. Besides that, the stuff above will be good for most of your project. As far as your connection goes and that fatal error. You might want to make sure you have properly set up the database. Sometimes the connection isnt "localhost" but is something else so check with your host. There could be about two dozen reasons why you cant connect but once you do just come back to this form because there's lots of good code here.
Good luck
bwest
Junior Poster in Training
57 posts since Jul 2004
Reputation Points: 14
Solved Threads: 1