SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard
    Join Date
    Feb 2007
    Location
    Southern California
    Posts
    1,388
    Mentioned
    1 Post(s)
    Tagged
    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.

    Question:
    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.

    Thanks,
    Steve

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

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


Bookmarks

Posting Permissions

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