If/Then, Simple I know.. Please help
-
I have probably the most simple PHP question on this forum. I have two <form> tags in my comments.php, one AJAXed and one traditional (Reason being the very first comment doesn’t work right, so I just want to use the standard form for the first comment on each post and then AJAXed for every additional comment). The code is simple:
<?php $numbcomments = comments_number('0', '1', '2'); ?>
<?php $nocommentsyet = "0"; ?>
<?php echo $numbcomments,$nocommentsyet; ?>
<?php if ($nocommentsyet == $numbcomments) { ?><?php echo "True"; ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"><?php } else { ?>
<?php echo "False"; ?>
<form id="commentform" onsubmit="new Ajax.Updater({success: 'commentlist'}, '<?php bloginfo('stylesheet_directory') ?>/comments-ajax.php', {asynchronous: true, evalScripts: true, insertion: Insertion.Bottom, onComplete: function(request){complete(request)}, onFailure: function(request){failure(request)}, onLoading: function(request){loading()}, parameters: Form.serialize(this)}); return false;"><?php } ?>
Problem is, the IF statement returns false every time no matter how many comments there are. What am I missing?
Btw, those echos are in there so when I load a post I can see for myself the variables values and verify that the statement SHOULD be true… but it’s not…
Or is there a simpler way that I don’t know?
- The topic ‘If/Then, Simple I know.. Please help’ is closed to new replies.