Multiple function parameters problem
Posted: Fri Nov 16, 2007 11:07 am
feyd | Please use
Now, on my HTML page I put:
Now I don't get any errors, but after I send a message or delete a message, it will always show the "Message has been sent" alert ... as if it can only read the first part of the if.
Anyone any ideas?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Evening all,
I'm trying to create a message centre, where users can sendand receive messages to each other, but I've hit a snag. I've got a three functions. Lets call them function a, function b and function c. Function B and C contain a variable each, which A needs to read. So in the parameters of function A I put in each variable. However, this spat an error out because the variables had not yet been created in function B and C since function A is the first to run. So, to try and combat that, I did the following:Code: Select all
function index($messageSent = FALSE, $deleteConfirm = FALSE)
{
if(!isset($_SESSION['MM_Username']))
{
echo 'Hello';
}
if(isset($messageSent) && $messageSent == TRUE)
{
$data['messageSent'] = 'yes';
}
if(isset($deleteConfirm) && $deleteConfirm == TRUE)
{
$data['deleteConfirm'] = 'yes';
}Code: Select all
<? if(isset($messageSent) && $messageSent == TRUE)
{?>
<p>Message has been sent</p>
<?
}
elseif(isset($deleteConfirm) && $deleteConfirm == TRUE)
{?>
<p>Messages have been deleted</p>
<?
}?>Anyone any ideas?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]