No announcement yet.

Select for name and address

  • Filter
  • Time
  • Show
Clear All
new posts

  • Select for name and address

    Hi, I have a simple form, Company Name, Address, City, State, Zip Code, Telephone. I have Company Name as a select field and it works just as it should. What I need it to do is show the other fields too, so if I choose Acme Credit Corp from the select field it will give me Acme Corp + Address, City, State, Zip Code, Telephone. What I also need is the option to insert a new record if the Company Name I need is not already listed.
    Thanks in advance

  • #2
    If you are storing company_id (id field from the company table) in the table that linked to your working form then you can have the select statement as per below to show those other details;

    SELECT company_id, sc_concat(name, ' ', address, ' ', city, ' ', state, ' ', zip)
    FROM company

    NOTE: change fields name accordingly

    To add a new company you can setup a button with PHP code as per below;

    sc_apl_conf("form_company", "start", "new");

    NOTE: change "form_company" to match the form name which you use to add/edit company details.


    • #3
      Thanks aari77, here's the SELECT I'm now using:
      SELECT SupplierID, sc_concat(PurchasedFrom,' ',street,' ',city,' ',state,' ',zip,' ',telephone)
      FROM tblsuppliers
      It works in as much as I get all the fields I want, but they're all in the PurchasedFrom field instead of populating their own fields. Don't think I made this clear in my original post. I've attached a screen shot...Any ideas?? Thanks