Forum Moderators: open

Message Too Old, No Replies

send results to db and pass them accross.

         

stevelibby

11:01 am on Feb 28, 2005 (gmt 0)

10+ Year Member



Hi all again.
I have created a search box. all works fine on the site however i want to save the information from the search into a db table and then pass the string accross to the results, i cant seem to do it?
In order for it to save to db i have to use the post option instead of the get. Im lost can someone help please.

txbakers

2:01 pm on Feb 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In order for it to save to db i have to use the post option instead of the get

No you don't. It's the query results that matter, not the method of the form submission.

Once you have the query, you can do an "INSERT...SELECT" type of statement which will insert all the rows from your query into the database.

The method has nothing to do with it.

stevelibby

2:23 pm on Feb 28, 2005 (gmt 0)

10+ Year Member



Sorry i currently use frontpage, but am trying to use asp coding, please explain in a little more detail please so i can fully follow what your saying.

topr8

2:28 pm on Feb 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



grab the search terms from the form values > insert into the search_terms_used table > query the db using the search terms > write the results to the page

stevelibby

2:38 pm on Feb 28, 2005 (gmt 0)

10+ Year Member



can you talk me through what to do....

too much information

2:50 pm on Feb 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



in ASP you would 'grab' the values by using the Request command:

<%
variable1 = Request.form("field_name1")
variable2 = Request.form("field_name2")
%>

(Use Request.querystring if your values are sent in the querystring.)

Then you would connect to your database, check with your setup to see what database type you are using and if you have a DSN setup.

After connecting to the database you would use SQL to enter the values into the database:

<%
theSQL = "insert into table_name (value1, value2) values ('" & variable1 & "', '" & variable2 & "');"
DBconnection.Execute(theSQL)
%>

There you go, values inserted into the database. You will need to search for how to connect to your database type, there are tons of resources online for learning that part.

stevelibby

3:04 pm on Feb 28, 2005 (gmt 0)

10+ Year Member



Star from the start, i have created a form using hard code, getting there slowly....
Okj i now want to insert the search form data into my db.
I have created the connection string to my db and now stuck...
so summery:
<%
Conection string..done

<<<<<It is this bit here that i am stuck>>>>

<form>
Bla
</form>