View Single Post
Old Feb 6th, 2007, 4:30 AM   #2
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 439
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
I'm not so sure I can identify what the problem is but the $session->logged_in doesn't make much sense if you haven't declared $session somewhere to be a new type of object. Unless you're trying to refer to the session superglobal array somehow, but for PHP 5 that would be of the sort $_SESSION, and you'd have to test that it's set or something. Not exactly sure what you're going for.

Furthermore I think javascript is unnecessary in what you're trying to achieve. If you're already using javascript might as well just do everything with it. In other words the use of the form isn't exactly necessary. To stick with PHP I would suggest using 3 radio buttons something of the form:
<input type="radio" name="type" value="delete"> Delete
<input type="radio" name="type" value="edit"> Edit
<input type="radio" name="type" value="share"> Share
Then it just becomes a matter of checking $_POST['type'] for the given operation you wish performed. Could even do it with numbers rather than strings:
<input type="radio" name="type" value="0"> Delete
<input type="radio" name="type" value="1"> Edit
<input type="radio" name="type" value="2"> Share
This would allow you to perform a switch statement for each particular case:
switch((int)$_POST['type']){
case 0: ...  // Delete code
case 1: ...  // Edit code
case 2: ...  // Share code
default: ... // In case of an error
}
I don't know that these suggestions actually help the problem you're currently experiencing which seems to be more of a session problem than it does a javascript or php error.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote