dynamic treeview with html,php and javascript and mysql - php

I have created a table in mysql database using php, and also i can displayed that table on the web form, But the thing is that i want to do, I have six field in my table.
That are,Sr_no which is auto increment, Process_no, Process Name, Ownership, Sheet Revision_no and Revision Date.
Now i want to make a dynamic tree view type in my field Process_no.
For eg: i have the value in that field M01, so when i'll click on M01 then there should be a sub-list under it, such as M01.1, M01.2,.... and so on. and this thing i want in every column of that field.
i had tried a lot but fail to do it.
if you have any solution or any code for it, then please help me.
i'm not a experience candidate, new at php and mysql.
so please help.

Related

PHP on a site with dynamic content

SO FAR I have made a website which is connected to a MYSQL database. On the website I have many buttons, each button corresponds to a table in my database. When I click the button, a javascript function opens my php file in this form
xmlhttp.open("GET", "addPoint.php?q=" + name, true); Where name is the name of the table
Back to the html. I have a div with an ID that will update with whatever the PHP echos.
The div is now populated with table, reflecting the table in mysql. This all works fine.
Here is the problem: I am trying to implement a voting system, where you vote by clicking on one of the elements of the newly created table. AFAIK the MYSQL updating which will need to happen for the vote to work, will need to be done in PHP, which means that I need to tell the PHP file
The name of the table
The name of the element
I am reluctant to use forms because I would like to just be able to click some text, NOT have to fill in a form or click a radio button.
So how do I get these 2 bits of info to a PHP file? Is the structure which I am doing this any good or should I step back and redesign?
Thanks for reading please let me know if I have been ambiguous.
Familiarize yourself with JQuery. It's great for projects like these.
http://www.w3schools.com/jquery/default.asp
As Norse already alluded to, use javascript to submit a "form" request for you. The javascript can populate the table and element values for you based on the button which was clicked. It is up to you whether this is a GET/POST.
JQuery would be a great way to help make this easier, but you don't need it if you don't want it.

Script to check data from Excel file to web page

I have an Excel spreadsheet with about 300 names which includes ID, first name and second name (different column each).
I have a website (not in English) that has forms to fill with people ID, first name, last name and a search button.
There's 2 outcomes that the search can provide:
either there will be one line massage under the form which indicate me NO result
or a new window will open to fill some details which means to me YES result (I don't need to fill those details, the new window display is the final result) and a new search will begin.
I need a script to auto insert the details from the Excel spreadsheet and return me yes or no results (or whatever 2 options result).
If the results can be inported from the Excel file that will be great.
Thanks in advance!
Start by looking at libraries like PHPExcel, then you can ask any specific questions over code that you're having problems with, but don't expect people to write your application for you

Adding new Tables in an Open Source Script (Beginner Question)

I'm still a new php beginner, in fact I just started learning couple a days ago.
I love to learn and implement at the same time on real scripts because that's motivate me to continue learning.
Yesterday I put my hands on an open source script (File Uploading Script)
And the script is pretty simple, and I want to create categories in the script
Example: When someone would like to upload he can choose the categorie of the file so it can be added there. I should create the values of the categorie (either in MYSQL or from Control panel)
What I want: I want you guys to tell me what exactly I should be doing. for example U should create something and something to do this. and that's all.(no accurate steps)
I know how to deal with mysqls and with php but I would like to get hints of what every programmer will should do that is all.
[DB Part]
You'll need to create a table contains 2 or 3 fields:
catID field (would be a primary key & autoincrement)
catName field (contains tha category name)
you can add a parentID (to have the catID of the parent category if there is any), imho, no real need for it as a beginner
you will need to link this table with files table taking catID as the foriegn key
[Form Part]
You can either list the categories in the uploading form, to be in a combo box, dropdown list, or even a check box, then insert it in the DB within the form,
or you can let the you user chose the category first before you show him the uploading form, then in your script you register the the catID in a session, & later when you upload the file you use that catID value
see?

Is there a way I can change where a PHP page selects from a MYSQL database by using a form?

I have a website and I want to make it easier for someone to change certain information being shown without them having to edit the HTML/PHP and using FTP.
At the moment I have this information in a php file which is included in the MYSQL query.
It would be a lot easier if this was done using a form, say a text field where a person can type the table name and it updates on the main page and starts displaying that table instead.
Sorry if I haven't explained this well. :(
I have a good news for you.
Every php/mysql-driven site in the world is made this exact way - to edit site contents using HTML form.
Even first PHP version name was PHP/FI, stands for Form Interpreter.
Even better, a site user doesn't have to deal with mysql - it's all being done in PHP. No need to type table names into form field - all table names already written in PHP code.
Usual PHP application being connected to just one mysql database - so, no need to choose.
As for the tables, it's being done this way: a user selects some human-readable matter, like "Latest news" and being redirected to the PHP script called, say, news.php. this script runs a query for the news table in the database and outputs some HTML formatted news highlights!
Even more, you don't even need to program! There are plenty of ready-made programs, such as Wordpress
store what you want to be editable in a mysql text field.
remove tags you dont want him to see
in the form echo the editable information in a textarea
have him edit
add tags
update the mysql
note depending on the users knowledge depends on how many tags you would like to remove/add. the less per a field the easier.
on more complicated things i like to have the person log in. if he has permission then all the editable fields have an edit button. if he clicks it it goes to a page with a form that he can use to edit that 1 field

php report button

I am working on a search script and on each search result I want a report link button. I am not sure how to make one. I have looked on google for answers but cannot come up with anything. Can anyone give me an idea of what to do? or does anyone know where there is an example of this? I plan on using the link id and making a new table on mysql to send reports to. I am just looking for a basic button to send reports to mysql I am just not sure what would be the best way to do it. I have the data for the link id's I just need to be able to report it to a new table I am assuming. Any suggestions or examples are very appreciated. Thanks.
Chris,
First you will want to create that new table in your database to capture this information. Lets assume to you will have the following fields (very basic, you may want to add more): ReportId, LinkId, DateReported. ReportId is our primary key, LinkId is the ID you reference in your question and the DateReported is the server time we logged the transaction.
With this table created you are going to want to create a new php page, lets call it report-link.php. You are going to want to make this page accept a querystring variable called linkid (accessible in the $_GET[] collection). In the code of this page you will want to write a SQL query that inserts the value of the linkid parameter into the new link report table in the database (along with the date()).
On your search page you will be able to have users report an entry by clicking a link with the href of /path/to/report-link.php?linkid=<?php echo $link_id; ?>
Please note this example is very simplistic in nature, and offers no security for spamming, pleasant end user experience after they click the link, but this is the process you will want to follow in setting this feature up. After you have it working you can spruce up the experience for your users.

Categories