Sorry if this is in the wrong area.
What i want to be able to do is allow the user to right click on a person and then they will see a context menu and be able to select things like edit delete and so on. i have all the names and addresses inside a database. I am still hit and missing and so not sure what to do. I can get this to show a menu and show everything up right without variables but i want the variable because i am doing this for a database that is going to have roughly 300+ contacts.
you will notice that there is a section that shows names and then a section with the menu part this is because i am still testing it out.
<html>
<head>
<link href="rightcontext.css" rel=STYLESHEET type="text/css">
<script type="text/javascript" src="rightcontext.js"></script>
<title>Page1</title>
<style type="text/css">
body {
font-family: verdana, arial, helvetica;
font-size:12px;
font-weight:normal;
}
</style>
</head>
<body>
<?
//first it connect to database then
// This will take all info from database where row tutorial is $item and collects it into $data variable
$data = mysql_query("SELECT * FROM email_contact_list WHERE emorpm ='Email'");
print ("Here is a list of all the email addresses in the database. <br><hr>");
// This creates a loop which will repeat itself until there are no more rows to select from the database. We getting the field names and storing them in the $row variable. This makes it easier to echo each field.
while($row = mysql_fetch_array($data)){
echo $row['lastname']. " "; echo $row['firstname']. " ";
if (isset($row['wifename']) && $row['wifename'] != NULL && $row['wifename'] != '') {
echo "&"; echo " "; echo $row['wifename']. "<br>";
}
else {
echo "<br>";
}
if (isset($row['address']) && $row['address'] != NULL && $row['address'] != '') {
echo $row['address']. "<br>";
}
if (isset($row['city']) && $row['city'] != NULL && $row['city'] != '') {
echo $row['city']. "<br>";
}
if (isset($row['province']) && $row['province'] != NULL && $row['province'] != '') {
echo $row['province']. "<br>" ;
}
if (isset($row['pc']) && $row['pc'] != NULL && $row['pc'] != '') {
echo $row['pc']. "<br>";
}
if (isset($row['country']) && $row['country'] != NULL && $row['country'] != '') {
echo $row['country']. "<br>";
}
if (isset($row['notes']) && $row['notes'] != NULL && $row['notes'] != '') {
echo $row['notes']. "<br>";
}
if (isset($row['emorpm']) && $row['emorpm'] != NULL && $row['emorpm'] != '') {
echo $row['emorpm']. "<br>";
}
if (isset($row['phone']) && $row['phone'] != NULL && $row['phone'] != '') {
echo $row['phone']. "<br>";
}
if (isset($row['email']) && $row['email'] != NULL && $row['email'] != '') {
echo $row['email']. "<br>";
}
if (isset($row['notes']) && $row['notes'] != NULL && $row['notes'] != '') {
echo $row['notes']. "<br>";
}
echo "<hr>";
}
print ("<br><hr><br>Listed above is all the people who are on the e-mail list");
echo "<br>";
echo "<span context='actions' a='Joe Blow' b='joe@email.blow' c='1234567890'>Joe Blow</span><BR>";
echo "<span context='actions' a='Georgio Shrubbery' b='georgioshrubb@whitehousen.gov' c='06666666666'>Georgio Shrubbery</span><BR>";
echo "<span context='actions' a='Homer Simpson' b='homer@simpsons.com' c='01239992021'>Homer Simpson</span>";
?>
<script type="text/javascript">
// and yet another menu
menu3 = { attributes: "a,b,c",
items: [
{type:RightContext.TYPE_MENU,
text:"Edit [a]",
onclick:function() {window.location = "<domain>?userid=[a]&action=edit"},
image: "icon.gif", align:"right" },
{type:RightContext.TYPE_MENU,
text:"View [a]",
onclick:function() {alert('View selected [b]')} },
{type:RightContext.TYPE_MENU,
text:"Delete [a]",
onclick:function() {alert('Delete selected: [a]')} },
{type: RightContext.TYPE_SEPERATOR },
{type:RightContext.TYPE_MENU,
text:"Email [a] [b];",
onclick:function() {alert('Email selected: [a]')} },
{type:RightContext.TYPE_MENU,
text:"Call [a] ([c])",
onclick:function() {alert('Call selected: [a]')} }
]
};
// add menu3 as 'actions' to the menu collection
RightContext.addMenu("actions", menu3);
// initialize RightContext
RightContext.initialize();
</script>
</body>
</html>