Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Table select
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Table select

 Post Reply Post Reply
Author
RedRaver View Drop Down
Newbie
Newbie


Joined: 02 December 2003
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote RedRaver Quote  Post ReplyReply Direct Link To This Post Topic: Table select
    Posted: 02 December 2003 at 9:40am

Hi there,

I have a db with tables according to the topics.

I would like to create a form with a drop down where you can select the topic, and acording the topic you select. The filled in fields go to that table...

So the name of the table should be replaced with what is selected in the from (in this case sales_comm)

I have this as code to add to the db:

<%
   ' Declaring variables
   Dim titles, sizes, group, sql_insert

   ' Receiving values from Form
   sizes = Request.Form("sizes")
   titles = Request.Form("titles")
   group = Request.Form("group")

   data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Intranet.mdb")
  
   sql_insert = "insert into sales_comm (titles, sizes) values ('" & titles & "', '" & sizes & "')"
   
   ' Creating Connection Object and opening the database
   Set con = Server.CreateObject("ADODB.Connection")
   con.Open data_source
   con.Execute sql_insert
   ' Done. Close the connection
   con.Close
   Set con = Nothing
  
   Response.Write "All records were successfully entered into the database."
%>

===================================================

and this as form:

<p>
  <select size="1" name="group">
    <option value="sales_comm">sales comm</option>
    <option value="corp_comm">corp comm</option>
  </select>
</p>
<p>Title<br>
      <input type="text" size="40" name="titles">
      <br>
    Size<br>
    <input type="text" size="40" name="sizes">
    <br>
    date<br>
    <input type="text" size="40" name="date">
    <br>
    download eu<br>
    <input type="text" size="40" name="download_eu">
    <br>
    download us<br>
    <input type="text" size="40" name="download_us">
    <br>
    view eu<br>
    <input type="text" size="40" name="view_eu">
    <br>
    view us<br>
    <input type="text" size="40" name="view_us">
    </p>
<p>
      <input type="Submit" value="Submit" name"Submit">
      </font>
</p>
</form>

Cheerzzz
RedRaver



Edited by RedRaver
Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2003 at 9:08am

dim table

table = Request.Form("group")

 

 sql_insert = "insert into " & table & " (titles, sizes) values ('" & titles & "', '" & sizes & "')"

did i understand you right?

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.