PHP Form / MYSQL Help

Hi All,

Thank you for taking the time to look at this problem, its been bugging me for a few days now.

What im looking to do is create a contact form with a difference, i want to be able to in my admin area, the ability to create unlimited forms, but of different types.

I have a basic knowledge of PHP but cant get my head round this.

So, from admin area i want to click on “create a form” page and be prompted with a page on the lines of this.

[PHP]

[/PHP]

Im not sue if im clear enough.

But the data inside the

tags needs to be stored in a MYSQL database, now im not sure how to do this.

do i do something like this?

ID - form_ID - Type - Name - input_ID - value - selected

That will mean that, i can just return all of those values to build the form that i select the ID for…

but coding all of this is a bit beyond me.

I hope all is well,

Daniel.

Hello Daniel,

I read your question a couple of times, but I’m not clear what you want exactly. You want a form to create forms ( I think I understood that ). I see no PHP in your code whatsoever so I can’t get any idea of your abilities. Nor do I get an idea of what you’re trying to do with the form.
I hope you’re not trying to build a rocket when you just discovered fire. ( so to say )

For storing stuff in a database you usually do something like this:
( the names of the ‘input’ fields in the HTML form correspond to the [‘name’] part in the $_REQUEST )
[php]
// Collect the data
$type = $_REQUEST[‘type’];
$name = $_REQUEST[‘name’];
$default = $_REQUEST[‘default’];
$size = $_REQUEST[‘size’];

// Prepare the SQL
// Assuming the name of the table you want to put the date into is ‘InputTable’
$query = “INSERT INTO InputTable ( type, name, default, size ) VALUES ( ‘$type’, ‘$name’, ‘$default’, ‘$size’ )”;

// I’m assuming you connected to a mysql database
mysql_query( $query );
if ( mysql_error() )
{ echo “An error occurred running the query [$query].
”. mysql_error() );
}
[/php]
After this there’s a row in your database that contains the values you put into it.

Hope it helps a little.
Good luck, O.

Sponsor our Newsletter | Privacy Policy | Terms of Service