Link to home
Create AccountLog in
Avatar of dpmatis
dpmatis

asked on

How do I use a form text field entry and save to one file then do a look up on another file? Dreamweaver/PHP/MySQL

I am currently desgined a inventory look up in Dreamweaver using PHP & MySQL.

I use a form to allow the user to enter the part # they would like to check price anddelivery on.

Currently I pass the entry to a "search results file which does query on the MYSQL file and displays filtered results.

I want to capture the entry the user made in the Entry form. I also want capturetheir IP Address, and then stamp the date and time the record was created.

Where do I do this and how ?

Please advise ... Dan
Avatar of rowejd
rowejd
Flag of United States of America image

In your database, you'd make a column for ip.  To find the user's IP address, you'd use:

$user_ip = $_SERVER['REMOTE_ADDR'];

In your database, too, you could make a created column with a TIMESTAMP data type.  This way when the user's data was added to the database, it would automatically show the creation time/date.
Avatar of dpmatis
dpmatis

ASKER

Thank you for the tips on the IP Address but where do I do this and how?

I have set up a MySQL data file to save the data to I just don't understand where and how to do this.

Do I do it on the search page or on the results page?  

and .. how?

Please advse ... Are there any site with examples or tutorials?
To answer you better I have 2 clarification questions:  First, how do you interact with your MySQL database in terms of creating new tables, fields, etc?  Using phpMyAdmin or Dreamweaver somehow?

The other question is...you said that you're allowing users to look up parts right?  So when they search for parts, what's the result?  It displays the part(s) that your script returns as a match?  I'm assuming this is the case.  Then when they see their match(es), what's the next step?  They add this to their cart or something?   Or you're trying to allow them to add a new part to the database?  I'm a little unclear as to what you're trying to do after you get the search results.
Avatar of dpmatis

ASKER

I am using Dreamweaver to build the site.
It is supposed to write much of the PHP code for you, so I was told.
Is it better to just do it in PHP?

Here is an example of how it works: www.onlinecomponents.com
Enter a part number (example 1N5818) then you click the submit button.
This takes you to a LIST page, from there you click on the link to a specific part and you see the indivudual part and pricing. Here you can add it to a cart.

I want to capture the text (part#) the user is entering into the search box to a table in MySQL and then show them the results same as in the onlinecomponents website.

Let me know if you need more information ...
ASKER CERTIFIED SOLUTION
Avatar of rowejd
rowejd
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Jason C. Levine
>> To answer your question about dreamweaver, I'm not sure honestly.

Dreamweaver will write very simple PHP code for you.  It's limited to writing selects, updates, inserts, and deletes as well as some repeating behaviors.  However, you will still need a solid understanding of PHP and MySQL to progress beyond the basics.

rowejd is pointing you down the right track.  From the same form, you want to be able to filter a recordset (search) and also insert the search terms and users IP?  This is not easily done with the DW wizards because the wizards assume one form per behavior.

The short answer is that you would add the insert action to the page with the search form and you will need to manually edit it to get the user's IP address in there.  
Avatar of dpmatis

ASKER

Thanks again