phatgreenbuds Posted September 5, 2008 Share Posted September 5, 2008 I have the following code for my function: function get_cust_content(){ $query = "SELECT * FROM tbl_content WHERE cust_id = '1' ORDER BY vid_desc ASC"; $cust_content = mysql_query($query); confirm_query($cust_content); //function higher up that validates the results return $cust_content; //returns the function result to the requesting file. } function list_content(){ $cust_content = get_cust_content(); //calls to the function above. ?> <select name="Content"> <?php do { ?> <option value="<?php echo $content['vid_desc']?>"><?php echo $content['vid_desc']?></option> <?php } while ($content = mysql_fetch_array($cust_content)) ; $rows = mysql_num_rows($cust_content); if ($rows > 0) { mysql_data_seek($cust_content, 0); $content = mysql_fetch_assoc($cust_content); }} ?> </select> This function works great...does exactly what I want it to. However when I place it in the file below its not displaying as I would have expected. <tr> <td><p>Select Content</p></td> <td><input name="content1" value="<?php list_content(); ?>"></td> </tr> The reason I am doing this is that the function needs to repeat and return post data based on the "input name=" portion of the form field. This input name will change with every repetition and post to a different field in the DB Quote Link to comment Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 My guess is that it should be <tr> <td><p>Select Content</p></td> <td> <select name="content1"> <?php list_content(); ?> </select> </td> </tr> Quote Link to comment Share on other sites More sharing options...
phatgreenbuds Posted September 5, 2008 Author Share Posted September 5, 2008 Well that was not entirely correct but it led me down the right path...so thank you for the assist. I got it to work based on what you provided plus a little more. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.