Click here to Skip to main content
15,350,730 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an html table and submit button that sends the tabledata with a GET to another file. My co-worker has created an OO php class that connects to the DB and has several functions that already writes or reads from the MS SQL DB.

I'm a little confused about the best way to go from my php file with the GET to the OO php class so I can use his functionality with the DB write. Should I stick the GET data (in visEupload.php) in an array and send it as a parameter to the StoreViseData function from there? What's the best way to intercept the GET data in visEupload.php without handling the pieces before I send them as a parameter to StoreViseData()? The GET data will be over 50 data pieces long eventually.

Most of our php in production is not OO.

I have been referring to this link: http://tangledindesign.com/how-to-create-a-contact-form-using-html5-css3-and-php/#comment-1428428110[^]

This is an excerpt from the BigTable.php (which is just html right now):

XML
<body>
    <h1> Visual Evaluation Entry Table </h1>
    <form method="get" action="visEupload.php">
<table id="bigTable" border="1">
    <thead>
     <tr>
       <th id="bandY" class="col3">Bands @263mm Y</th><th id="bandM" class="col3">Bands @263mm M</th><th id="bandC" class="col3">Bands @263mm C</th><th id="bandK" class="col3">Bands @263mm K</th><th id="Comments" class="col3">Comments</th>
     </tr>
    </thead>
    <tbody>
        <tr >
            <td><input name="bandY" ></td> <!-- //Row 0 Column 1-->
            <td><input name="bandM" ></td>  <!--//Row 0 Column 2-->
            <td><input name="bandC" ></td>  <!--//Row 0 Column 3-->
            <td><input name="bandK" ></td>  <!--//Row 0 Column 4-->
            <td><input name="comment" ></td>  <!--//Row 0 Column 4-->
        </tr>
    </tbody>

</table>
  <input id="submit" type="submit" class="list" name="submit" value="Submit To Database" >

   </form>
</body>



This is an excerpt from the visEupload.php where I have the GET, and intend to access the OLAP Database class. I'm not sure the best way to send the data to the $OLAPdb class/function:

PHP
<body>

<?php


    require_once( "../classes/class.OLAPdatabase.php");
    require_once( "../common/Session.php");
    $OLAPdb = new OLAPdatabase;



    if (isset($_GET['submit'])){
        $bandY= $_GET['bandY'];
        $bandM= $_GET['bandM'];
        $bandC= $_GET['bandC'];
        $bandK= $_GET['bandK'];

        $comment=$_GET['comment'];

        $OLAPdb->StoreViseData(); //I'm not sure how to send GET data up here so I can process the data later in the OLAPdb class instead.
 
    }
   ?>
</body>
Posted
Updated 17-Jun-14 10:20am
v3
Comments
Mohibur Rashid 17-Jun-14 20:17pm
   
You are lack of basic php programming knowledge.
MichCl 18-Jun-14 8:10am
   
Thank you that was very helpful

1 solution

You can pass the get parameters to the relevant methods of a class object through method arguments. Learn OOP PHP
[^]
   
Comments
MichCl 18-Jun-14 9:27am
   
It seems like there should be a good php way to do it using the php arrays and such that are used with GET. I found this example, but it's not making use of the php workings behind the scenes, so to speak. http://tisuchi.wordpress.com/2011/11/30/form-data-with-oo-php/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900