Jump to content

form


bojak71730

Recommended Posts

OK, I am fairly new to PHP, so may make an error here. But, if you follow these instructions, it should work.

I will assume that your form will be named form.php (or something like that - at least with a php extension).

In that file (your form file), near the top, place the following code:

# connect to database
include("log.php");

1. The "# connect to database" is just a comment to indicate what the code is for.

2. You can use any name for the file as long as the extension is .php (db.php, connect.php, etc).

3. Create a file called log.php and put the following code in it:

<?php
$db = mysql_connect("localhost", "user_name", "password");
mysql_select_db("db_name");
?>

Where "localhost" is the required server name (normally localhost - may not be in your case)

user_name is your server user user name (usually supplied by the server host)

password - same as above

db_name is the name of your database (not the table - that will be named in your file where you indicate sotrage address).

Hope this helps...

If any of you journeymen see problems here please correct me!!




Link to comment
Share on other sites

[!--quoteo(post=374181:date=May 15 2006, 10:36 PM:name=bojak_cates)--][div class=\'quotetop\']QUOTE(bojak_cates @ May 15 2006, 10:36 PM) [snapback]374181[/snapback][/div][div class=\'quotemain\'][!--quotec--]
im gonna make a order form and its going to connect to mysql the only problem i have is i dont know how to make it secure i dont yet have it coded this is just an idea that came about in my head and i didnt know how to fix that problem[/quote]
What is it that you want to make 'secure'? If we knew that, we could build on the answer already posted, or point you in the right direction. Form secure? Database secure? Something else secure? Help us help you.
Link to comment
Share on other sites

[!--quoteo(post=374187:date=May 15 2006, 10:11 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 15 2006, 10:11 PM) [snapback]374187[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What is it that you want to make 'secure'? If we knew that, we could build on the answer already posted, or point you in the right direction. Form secure? Database secure? Something else secure? Help us help you.
[/quote] what i mean is it will prolly really easy to get information from a form im sure there is hackers out there that can crack forms or dbs to get info like this so i need to make the form secure as well as the db i guess u could say
Link to comment
Share on other sites

For the form to be useful, it has to be visible to your site's visitors. And they can view the html source code so 'cracking' a form is a trivial (and pointless) exercise. If you only want 'authorized' visitors to view your form, explain how and why.

php scripts cannot be read with a browser (only the html they generate). Assuming you don't broadcast your database username and password, your database is as secure as it is going to get.

So, if you have some specific questions ask them here or use Google to track down whatever it is you need.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.