While Loop Not Outputting

Hi All,

Hope all is well… I’m having a problem with a while loop… from what I can see it all looks fine… I have a piece of javascript running within the PHP code that basically when its clicked is to show a textarea and it is to do this for each record in my table. I’ve put the code in below… any help would be great.

Thank you

while ($rowc = mysql_fetch_array($resulta)) {
																	
																
							 echo '<div id="profile_pic"/><a href="member-profile.php?member_id=' . $rowc['member_id'] . '"/><img src="'.$rowc['profile_pic'].'" width="64" height="64" alt="" /></a></div>';
							echo '<div id="profile_holder">';
							echo '<div id="profile_info"><p><strong><a href="member-profile.php?member_id=' . $rowc['member_id'] . '"/>' . $rowc['firstname'] . ' ' . $rowc['lastname'].'</a></strong> says '.$rowc['shared_deal'].'</p><br /></div>
			
							<p><a href="#" onclick="document.getElementById(\\'textHolder\\').style.display=\\'block\\';" >Comment</a> | <a href="">Recommend</a></p>
							<div id="textHolder" style="display:none;">
							<form name="" method="POST" action="member-index.php?member_id='.$_SESSION['SESS_MEMBER_ID'].'">
							<input type="hidden" name="member_id" valiue="'.$_SESSION['SESS_MEMBER_ID'].'"/>
							<input type="hidden" name="firstname" value="'.$_SESSION['SESS_FIRST_NAME'].'"/>
							<input type="hidden" name="lastname" value="'.$_SESSION['SESS_LAST_NAME'].'"/>
							<input type="hidden" name="deal_id" value="'.$rowc['deal_id'].'"/>
 						   <textarea rows="14" name="comment_text" cols="5" class="comment_area" placeholder="Enter Your Comment"></textarea>
						    						   <input type="submit" name="comment" value="Comment" />
							</form>
</div>';
							echo '</div>';
		

Just to be precise: the javascript doesn’t run inside the php code, it’s outputted like the rest of the html/css code and sent to the browser.

As far as your problem is concerned, doesn’t that loop output anything? Then your query isn’t returning any rows.

The loop outputs the records in the database… however when your click on the comment link where the Javascript is located it outputs one comment box at the top of the page… when what I want is each comment link to have its own comment box… if that makes sense :slight_smile:

Maybe :slight_smile:
But that’s a javascript question. I’ve moved this thread to the JS forum.
Could you please post the resulting html/js code created by this script?

Just to be clear the While loop is written in PHP and the only Javascript that is within the code is in this line here:

<p><a href=“#” onclick=“document.getElementById(\‘textHolder\’).style.display=\‘block\’;” >Comment</a> | <a href=“”>Recommend</a></p>

When the user clicks the comment link it gets a div tag that contains a textarea as shown below:

						&lt;div id="textHolder" style="display:none;"&gt;
						&lt;form name="" method="POST" action="member-index.php"&gt;
						&lt;input type="hidden" name="member_id" valiue=""/&gt;
						&lt;input type="hidden" name="firstname" value=""/&gt;
						&lt;input type="hidden" name="lastname" value=""/&gt;
						&lt;input type="hidden" name="deal_id" value=""/&gt;
					   &lt;textarea rows="14" name="comment_text" cols="5" class="comment_area" placeholder="Enter Your Comment"&gt;&lt;/textarea&gt;
					    						   &lt;input type="submit" name="comment" value="Comment" /&gt;
						&lt;/form&gt;

What needs to happen is when I click comment is for it to show a text area for each of the records in my database: Example if I see a status and I want to comment on this, I click comment and a textarea appears under that status… once I’ve left comment I then see another status further down the page I press comment and what needs to happen is the textarea to appear below that persons status, not to go to the top of the page.

Hey

Quick update for you all… I have solved the problem by using the deal_id in my table as a number to differentiate each of the different outputs… :smiley:

Thank you all for your advice