Retrieving data from link
Posted: Fri Jan 13, 2012 5:05 am
I have table designed in HTML that has many attributes using PHP.
One of them I want it to be a link to another page.
When the user go to the second page, I want to receive specific attribute and fetch from the database depending on this attribute.
I don't know how to use GET or POST methods with tables? Can we? Because it is not usual form!
This is the line that I want to add to it the $proj_num so in the other page I can fetch the information related to this specific $proj_num?
<td><a href="project_details.php" class="action"><?php echo ($proj_num);?></a></td>
So, My question is: How to send this specific attribute and how to receive it in the other page and fetch depending on it?
Hope my question is clear?
For your information of you need them, these are the tables I created in the database:
CREATE TABLE IF NOT EXISTS `projects` (
`id` int(150) NOT NULL AUTO_INCREMENT,
`proj_num` varchar(11) DEFAULT NULL,
`proj_desc` varchar(150) NOT NULL,
`customer` varchar(150) NOT NULL,
`plan_revenue` int(150) NOT NULL,
`plan_cost` int(150) NOT NULL,
`available_budget` int(150) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `proj_num` (`proj_num`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
CREATE TABLE IF NOT EXISTS `purchase_orders` (
`id` int(50) NOT NULL AUTO_INCREMENT,
`proj_num` varchar(100) NOT NULL,
`po_desc` varchar(100) NOT NULL,
`amount` int(50) NOT NULL,
`po_num` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `po_num` (`po_num`),
KEY `proj_num` (`proj_num`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
CREATE TABLE IF NOT EXISTS `items` (
`id` int(50) NOT NULL AUTO_INCREMENT,
`po_num` varchar(100) NOT NULL,
`item_num` varchar(50) NOT NULL,
`item_desc` varchar(100) NOT NULL,
`item_quant` int(50) NOT NULL,
`item_price` int(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `item_num` (`item_num`),
KEY `po_num` (`po_num`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
One of them I want it to be a link to another page.
When the user go to the second page, I want to receive specific attribute and fetch from the database depending on this attribute.
I don't know how to use GET or POST methods with tables? Can we? Because it is not usual form!
This is the line that I want to add to it the $proj_num so in the other page I can fetch the information related to this specific $proj_num?
<td><a href="project_details.php" class="action"><?php echo ($proj_num);?></a></td>
So, My question is: How to send this specific attribute and how to receive it in the other page and fetch depending on it?
Hope my question is clear?
For your information of you need them, these are the tables I created in the database:
CREATE TABLE IF NOT EXISTS `projects` (
`id` int(150) NOT NULL AUTO_INCREMENT,
`proj_num` varchar(11) DEFAULT NULL,
`proj_desc` varchar(150) NOT NULL,
`customer` varchar(150) NOT NULL,
`plan_revenue` int(150) NOT NULL,
`plan_cost` int(150) NOT NULL,
`available_budget` int(150) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `proj_num` (`proj_num`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
CREATE TABLE IF NOT EXISTS `purchase_orders` (
`id` int(50) NOT NULL AUTO_INCREMENT,
`proj_num` varchar(100) NOT NULL,
`po_desc` varchar(100) NOT NULL,
`amount` int(50) NOT NULL,
`po_num` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `po_num` (`po_num`),
KEY `proj_num` (`proj_num`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
CREATE TABLE IF NOT EXISTS `items` (
`id` int(50) NOT NULL AUTO_INCREMENT,
`po_num` varchar(100) NOT NULL,
`item_num` varchar(50) NOT NULL,
`item_desc` varchar(100) NOT NULL,
`item_quant` int(50) NOT NULL,
`item_price` int(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `item_num` (`item_num`),
KEY `po_num` (`po_num`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;