auto generate link URL from database
auto generate link URL from database
Hi Alan. Love Datatables, it makes my life a lot easier. I am the dangerous kind of developer - self taught and non professional lol. I know just enough to frustrate myself :-) So hence my question :
I have successfully created a page that uses datatables to load a phpMysql dataset into a table using JSON. No problem at all there. What I need to do after this though is make it so that in each line there is a clickable button (form button or graphic, don't really care which) that when clicked generates a url based on which row was clicked. So for example, if the locID (my index field) in the clicked row is "22", I want it to generate a url similar to www.myurl.com/process.php?parameter=22" and navigate to it so that my php script can respond according to what row was clicked on. There seem to be complex ways of doing it that i have a hard time wrapping my head around... is there a simple way for us non experts? My problem is when I look at the example code, not being a java expert i don't really grasp what the most relevant lines are for me. For example I don't even know whether the best way would be to do it in the server_processing.php file, or client side. Thanks in advance for your help
I have successfully created a page that uses datatables to load a phpMysql dataset into a table using JSON. No problem at all there. What I need to do after this though is make it so that in each line there is a clickable button (form button or graphic, don't really care which) that when clicked generates a url based on which row was clicked. So for example, if the locID (my index field) in the clicked row is "22", I want it to generate a url similar to www.myurl.com/process.php?parameter=22" and navigate to it so that my php script can respond according to what row was clicked on. There seem to be complex ways of doing it that i have a hard time wrapping my head around... is there a simple way for us non experts? My problem is when I look at the example code, not being a java expert i don't really grasp what the most relevant lines are for me. For example I don't even know whether the best way would be to do it in the server_processing.php file, or client side. Thanks in advance for your help
This discussion has been closed.
Replies
[code]
$foobar3 = $aRow[ $aColumns[$i] ];
$foobar1 = '';
$row[] = $foobar1. '>'. $aRow[ $aColumns[$i] ] .'';
[/code]
this adds a link and the first part of the url up to where the variable needs to be, and then adds the column value, and then closes off the html syntax to make it a valid tag. Then when you view the page the column in question calls the "detail" page and passes the value to it for further processing. Hope it helps anyone in the same boat as me.