Hi All,
Im having trouble to send a variable with 2 values in a link
deptid = COM_CFO and COM_FIN
<area shape="rect" coords="595,381,701,419" href="" onMouseOver="open_new_window('dept_stafflist.php?deptid=COM_CFO','','width=500,height=300,left=10,top=10,scrollbars=1,location=no,status=no')" onMouseOut="close_window()" alt="cfo" />
how do i put it?
dept_stafflist.php?deptid=COM_CFO&&COM_FIN wont work.
dept_stafflist.php?deptid=COM_CFO&&deptid=COM_FIN wont work too.
Please help.
Thanks in advance.
How to send a variable with 2 values in a link?
Moderator: General Moderators
-
adityamenon90
- Forum Newbie
- Posts: 7
- Joined: Fri Apr 16, 2010 1:41 pm
Re: How to send a variable with 2 values in a link?
send them in an array
Code: Select all
dept_stafflist.php?deptid[]=COM_CFO&deptid[]=COM_FIN
Re: How to send a variable with 2 values in a link?
thanks but is there any other way else?
im not good in array.
im not good in array.
-
adityamenon90
- Forum Newbie
- Posts: 7
- Joined: Fri Apr 16, 2010 1:41 pm
Re: How to send a variable with 2 values in a link?
You must get good. Arrays are incredibly useful - actually indispensable and irreplaceable. You just gotta power through the pain of wrapping your head around using them for the first time.
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: How to send a variable with 2 values in a link?
How do want to use these values? I am guessing on page dept_stafflist.php you will retrieve them using $_GET? If so, the other poster has a good point. Using the array is an easy method, and if you look at the result, it is not difficult to extract the values
Code: Select all
<?php
// assuming your url is dept_stafflist.php?deptid[]=COM_CFO&deptid[]=COM_FIN
// retrieve the values in the following manner
$_GET['deptid'][0]; // contains COM_CFO
$_GET['deptid'][1]; // contains COM_FIN
?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering