Increasing HTML table with PHP - php

I'm having problems with my work - I want to automatically insert a table when user registers. I've already finished the registration part but how can I show another user the users registered with table tag?

There are two ways to achieve this:
If you are using form submit and redirection than put the table in a foreach() loop with the data array coming from database table. Then when ever user comes on this page it takes all the newly added values and render the table.
Use jQuery Ajax to save the data and append new <tr> row into table body.

Related

PHP Loading MySQL Columns For a UniqieID Then Updating Columns

Sorry very new to PHP and MySQL. I'm pretty close to having what I need. I created a database that hold values as shown here:
I was able to find some things online to create a form and initially get the data into the database
What I would like to do is have another page to load values for a specific customer by searching for their uniqueid. So have a input box where you input the uniqueid then the current values for that customer get loaded into a form just like the "Customer Creation Form". Then be able to update the loaded values in the the form and save it back. The enddate is probably the field that would be updated the most.
You could use Ajax requests and PHP to update the form live (or update once the user has entered the UniqueId)
https://www.w3schools.com/php/php_ajax_php.asp
To return multiple values grabbed from the database, use php to create an array return it as a json file.
https://www.w3schools.com/js/js_json_intro.asp
https://www.w3schools.com/js/js_json_arrays.asp
https://www.w3schools.com/js/js_json_php.asp

How to retrieve table row data in php by using an <a>(link)?

I want to implement an inventory table visible below. What I want to know is how to retrieve a table row data, for example when I click the "edit" link from the row of "Item One", I can retrieve it's Item ID "A00". Well, the rest will be up to me after I retrieved that row data. I just want to know first how to retrieve it.
Please be informed that I have already displayed the table shown using php, retrieving of table row data by clicking those <a> links is the only thing I need to know. Please give me a hint on how to do it, I really need it for our project. This is important to us, any help would be appreciated, thank you very much for your ample time!
Use jQuery Ajax and pass your ID as a parameter to the PHP file. Then your PHP file fetches the respective row from your database table.
Alternatively, you can just use jQuery/Javascript to load the content of the current row into the form and 'on update' you can update your database row with the new values. Ajax can also be used in this case so that the page doesn't refresh.
Try this:
Using jQuery ajax you can pass the ID of that record to php file.
Inside that file, You can retrieve the data of that row using ID you passed. For that, use SELECT query to get row data.
Then pass data to jQuery response to use it in the form to display.
Thanks

Update select contents without reloading form

I have quite a long form which has many HTML form selects pulling data from MySQL tables - quite often a client will be mid way through filling in the form when they realise that the value they want for department, for example, has not yet been entered into the system so is not in the list.
I have added a link to a simplified popup for adding departments but after it is added it does not appear in the select list as the contents of that select are based on what was available on the load of the page when the initial query ran - how can I get the select to update without having to submit and then edit, without the page refreshing/reloading and without the client losing the data they have currently added?
Thanks
Did read what you are asking, since its too long) But did you try javascript? changing form values after paged loaded is possible only with javascript.
When submit form on that popup, save it with ajax in database, and as response get inserted data... Then on ajax success add new option in select ( with returned data )

JavaScript form into PHP table

I am creating a website. On one of the pages there is a JavaScript form that asks for the usual information: Name, email etc and then I need to save it into a table using MYSQL and then I want to display the table using PHP on another page. I have no idea how to start saving the data into a table (when Submit is hit) and then displaying the table on another page. Any advice?
http://teamtutorials.com/web-development-tutorials/php-tutorials/inserting-data-into-a-mysql-database-using-php#.T5rIZLNWq9Q

passing a dynamic html table to php as an array

I have a dynamic html table( rows are added dynamically using java script) and I want to pass whole table to a php script as an array.Is there a way to insert the table data to an array?
I have tried using phpTableExtractor but it dosen't extract dynamically added rows.
I don't see any other reliable solution but creating a HTML form along with the table and have the user click a submit button to save the table. Then you can read all content from $_POST and store it in a database.
Another solution would be to use AJAX requests to store the table content every time the focus changes or something like that. Will make your page dependent on JavaScript though.
What if you fill a JS array at the same time you create the table?
You will use the html just for display but behind you have the data you send to php.

Categories