ghosttr Posted September 18, 2007 Share Posted September 18, 2007 I have this code displays my database information in a table. I have a 2 column table the first column is for the data, the second is where i want the script to put the form. <?php $username="<username>"; $password="<password>"; $database="<database>"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT name FROM <table1>"; $result = mysql_query($query) or die(mysql_error()); echo "<table border='1'>"; echo "<tr><th>Name</th><th>Value</th></tr>"; while($row = mysql_fetch_array($result)){ echo "<tr><td>"; echo $row['name']; echo "</td><td>"; } echo "</table>"; //} ?> Since the number of items will vary from time to time its not very practical to create static forms either Quote Link to comment https://forums.phpfreaks.com/topic/69742-need-to-insert-form-in-php-output/ Share on other sites More sharing options...
AV1611 Posted September 18, 2007 Share Posted September 18, 2007 your questions is quite vague... Do you wish them to EDIT what the value associated with the name in the table is? That's easy... just add a complete form in the next field... Am I missing what you are asking??? Quote Link to comment https://forums.phpfreaks.com/topic/69742-need-to-insert-form-in-php-output/#findComment-350413 Share on other sites More sharing options...
ghosttr Posted September 18, 2007 Author Share Posted September 18, 2007 I have a list of items that when imported to my database have no value. I need to give each item a value, which i have been doing manually through phpmyadmin. I have been using a script that moves the unedited items to a different table that i merge with the real list when im done editing it. The problem is that this is very time consuming. So i have this script which is pulling the list of unedited items, and displaying them in a form. And what needs done is that for every item it lists the script also needs to generate a form with it, so that i can just enter my data, and submit it when im all done. Im still new to php and haven't been able to find a way to do this. I need something like this for every <item> insert <form> that will generate a form for every item Quote Link to comment https://forums.phpfreaks.com/topic/69742-need-to-insert-form-in-php-output/#findComment-350429 Share on other sites More sharing options...
AV1611 Posted September 18, 2007 Share Posted September 18, 2007 if this is a "throw away" script, why don't you d/l the files from the table, create a text file the way you want it, then upload it and be done. beats what you are doing... Quote Link to comment https://forums.phpfreaks.com/topic/69742-need-to-insert-form-in-php-output/#findComment-350435 Share on other sites More sharing options...
ghosttr Posted September 18, 2007 Author Share Posted September 18, 2007 if this is a "throw away" script, why don't you d/l the files from the table, create a text file the way you want it, then upload it and be done. beats what you are doing... Well that works too, but i would also like to be able to let other who dont have database access edit the list if i need them to. If I could add a form to the results it would mean that i could provide a link to the page and have someone else edit it. And I could remove the second table and just use a select command to get the data, edit it through the forms and repost it back into the original database. Quote Link to comment https://forums.phpfreaks.com/topic/69742-need-to-insert-form-in-php-output/#findComment-350440 Share on other sites More sharing options...
AV1611 Posted September 18, 2007 Share Posted September 18, 2007 short of writing the script for you, just display the table to screen and just add the second field with what is in it set as the value of the input box, and let them either edit the field or leave it as is, when they are done making changes the submit writes all the changes... Quote Link to comment https://forums.phpfreaks.com/topic/69742-need-to-insert-form-in-php-output/#findComment-350447 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.