Crowds
05-21-2006, 02:20 PM
In a simple Spry based image gallery I have created a comment script. But I dont want the add comment form to be visible until you press an 'Add Comment' button.
I have done something similar before with a jump menu that worked just fine using the below code
<form name="form1" id="form1">
<select name="artists" onchange="MM_jumpMenu('parent',this,0)">
<option value="index.php?inc=1" selected="selected">Select Artist</option>
<option value="index.php?inc=2">op1</option>
<option value="index.php?inc=3">op2</option>
</select>
</form>
<?
parse_str($_SERVER['QUERY_STRING']);
if (empty($inc)) {
include 'def.php';
} else {
switch($inc) {
case '1':
include_once('def.php');
break;
case '2':
include_once('op1.php');
break;
case '3':
include_once('op2.php');
break;
}
}
?>
I am now trying to adjust this to work on a submit button and I have
<form name="comment" id="comment" action="index.php?inc=1">
<input name="submit" type="submit" value="Add Comment" />
</form>
<?
parse_str($_SERVER['QUERY_STRING']);
if (empty($inc)) {
include 'commentlog.php';
} else {
switch($inc) {
case '1':
include_once('comment.php');
break;
}
}
?>
But it is not working.
Where am I going wrong? or would there be a more simple way of doing this ?
crowds
I have done something similar before with a jump menu that worked just fine using the below code
<form name="form1" id="form1">
<select name="artists" onchange="MM_jumpMenu('parent',this,0)">
<option value="index.php?inc=1" selected="selected">Select Artist</option>
<option value="index.php?inc=2">op1</option>
<option value="index.php?inc=3">op2</option>
</select>
</form>
<?
parse_str($_SERVER['QUERY_STRING']);
if (empty($inc)) {
include 'def.php';
} else {
switch($inc) {
case '1':
include_once('def.php');
break;
case '2':
include_once('op1.php');
break;
case '3':
include_once('op2.php');
break;
}
}
?>
I am now trying to adjust this to work on a submit button and I have
<form name="comment" id="comment" action="index.php?inc=1">
<input name="submit" type="submit" value="Add Comment" />
</form>
<?
parse_str($_SERVER['QUERY_STRING']);
if (empty($inc)) {
include 'commentlog.php';
} else {
switch($inc) {
case '1':
include_once('comment.php');
break;
}
}
?>
But it is not working.
Where am I going wrong? or would there be a more simple way of doing this ?
crowds