SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard
    Join Date
    Feb 2007
    Southern California
    1 Post(s)
    1 Thread(s)

    Using "isset" for more than one table in a CMS page

    <?php if (isset($_POST['tech'])):

    I'm using this code in a CMS page to enter data into a table. The code checks to see if the user had entered anything in the 'tech' input box in the form on that page. If so, it executes the query to insert everything into a table.

    What if I want to enter data into two separate tables? How should I adjust the code? Specifically, I want the CMS page to be used to enter info into any number of tables, and where entering data into the other tables is not necessary. How do I adjust the above code to reflect more than one table, but only one table might have data entered in? Also, I want to push one Submit button for all the tables at once.

    If I used the above code and entered data into only one table, leaving the other table's form field empty, that table gets NULL data inserted because the query for both tables is being executed after I hit the Submit button. That's the problem I have.


  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Toronto, Canada
    63 Post(s)
    3 Thread(s)
    this is not a mysql question

    moving thread to php forum | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts