cpucci
asked on
form tag breaking code
Hello,
I am having a very strange problem. A standard form tag is breaking my code. I've messed with it all day today and can't figure out what is going on. If you can see the problem in the code below, please let me know:
<div class="area_scroll">
<table width="95%" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20">
<p class="text" align="center" style="color:ffffff;"><str ong>Commen ts</strong ></p>
</td>
</tr>
</table>
<table width="95%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td>
<?php if ($comments_html != "")
{
echo $comments_html;
} ?>
</td>
</tr>
</table>
<?php if (($mode == "default") && $comments_on) { ?>
<form action="/com.php" method="post" name="comments"> // everything works when this tag is removed
<table width="50%" border="0" align="center">
<tr>
<td colspan="2">
<div align="center">
<textarea class='text' style='background-color:#0 00000;colo r:#ffffff; border-top : #33393A 1px solid;border-bottom: #33393A 1px solid;border-left: #33393A 1px solid;border-right: #33393A 1px solid;' name="comment" rows="8" cols="50"><?php echo $comment ?>
</textarea>
</div>
</td>
</tr>
<tr>
<td width="35%"><p align="center" class="text"><font color="#ffffff">Your Name:</font></p></td>
<td>
<div align="center">
<input class='text' style='background-color:#0 00000;colo r:#ffffff; border-top : #33393A 1px solid;border-bottom: #33393A 1px solid;border-left: #33393A 1px solid;border-right: #33393A 1px solid;' name="name" type="text" value="<?php echo $name ?>" size="25" maxlength=64>
</div>
</td>
</tr>
<tr>
<td height="26" colspan="2" class="full_border">
<div align="center">
<input type="hidden" name="artist_number" value="<?php echo $number ?>">
<input type="hidden" name="artist_id" value="<?php echo $id ?>">
<input type="hidden" name="mode" value="<?php echo $mode ?>">
<input name="submit" type="image" src="/images/submit.jpg" width="90" height="15">
</div>
</td>
</tr>
</table>
</form>
<?php } ?>
</div> // this is the end of the area scroll div: it's showing up as an unclosed or unneeded tag
Everything below this get's screwed up as well like there is an open tag somewhere.
Any help is appreciated.
thanks,
Chris
I am having a very strange problem. A standard form tag is breaking my code. I've messed with it all day today and can't figure out what is going on. If you can see the problem in the code below, please let me know:
<div class="area_scroll">
<table width="95%" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20">
<p class="text" align="center" style="color:ffffff;"><str
</td>
</tr>
</table>
<table width="95%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td>
<?php if ($comments_html != "")
{
echo $comments_html;
} ?>
</td>
</tr>
</table>
<?php if (($mode == "default") && $comments_on) { ?>
<form action="/com.php" method="post" name="comments"> // everything works when this tag is removed
<table width="50%" border="0" align="center">
<tr>
<td colspan="2">
<div align="center">
<textarea class='text' style='background-color:#0
</textarea>
</div>
</td>
</tr>
<tr>
<td width="35%"><p align="center" class="text"><font color="#ffffff">Your Name:</font></p></td>
<td>
<div align="center">
<input class='text' style='background-color:#0
</div>
</td>
</tr>
<tr>
<td height="26" colspan="2" class="full_border">
<div align="center">
<input type="hidden" name="artist_number" value="<?php echo $number ?>">
<input type="hidden" name="artist_id" value="<?php echo $id ?>">
<input type="hidden" name="mode" value="<?php echo $mode ?>">
<input name="submit" type="image" src="/images/submit.jpg" width="90" height="15">
</div>
</td>
</tr>
</table>
</form>
<?php } ?>
</div> // this is the end of the area scroll div: it's showing up as an unclosed or unneeded tag
Everything below this get's screwed up as well like there is an open tag somewhere.
Any help is appreciated.
thanks,
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> </div> // this is the end of the area scroll div: it's showing up as an unclosed or unneeded tag
seems like there something in your comment that corrupts the page.
use the "htmlentities" method before echoing the data:
<?php echo htmlentities($comment) ?>
seems like there something in your comment that corrupts the page.
use the "htmlentities" method before echoing the data:
<?php echo htmlentities($comment) ?>
dont use dreamweaver to check your code. it is poor at best - validate your generated html to see if there are really issues. if it looks fine, and validates on w3.org, you are fine.
ASKER
Not really sure what to do with this topic. Output looks correct, doesn't really seem to be a problem and nothing above has really addressed the issue if there is one. Moderator or experts, please advise.
thanks,
Chris
thanks,
Chris
Do you mean that you don't have the problem anymore?
If so, it must have been something in your comment data that corrupted the page.
If you still have the problem, please post a link to your page.
If so, it must have been something in your comment data that corrupted the page.
If you still have the problem, please post a link to your page.
I don't know if I correctly understood the problem and if it is already solved.
if com.php is in the same directory of the file you posted try so:
<form action="com.php" method="post" name="comments">
or
<form action="../com.php" method="post" name="comments">
instead of
<form action="/com.php" method="post" name="comments">
if com.php is in the same directory of the file you posted try so:
<form action="com.php" method="post" name="comments">
or
<form action="../com.php" method="post" name="comments">
instead of
<form action="/com.php" method="post" name="comments">
Also the values which you echo into the form (value="<?php echo $name ?>") could truncate your form.
if $name or other varibles contain a quote, the value attribute would be "closed"
i.e. value = " name"with quotes "
In this case value would be value = " name" and with quotes " will probabli truncate your form
if $name or other varibles contain a quote, the value attribute would be "closed"
i.e. value = " name"with quotes "
In this case value would be value = " name" and with quotes " will probabli truncate your form
check what is going inside the </textarea>
better, there is something in that code that is causeing this problem
better, there is something in that code that is causeing this problem
ASKER
Not sure how to award points on this question. I found the problem which was actually had nothing to do with what I thought it was. Moderator, please distribute points as you see fit and close this question.
cpucci, you first need to explain what the problem was and what solution you found.
then, if what we posted did not help you at all, you just ask for a PAQ + refund in the comunity support.
then, if what we posted did not help you at all, you just ask for a PAQ + refund in the comunity support.
ASKER
The html output actually looks correct. The problem is that one, dreamweaver is showing a bunch of broken tags with this form attribute added and two, the form doesn't submit properly. It should submit to com.php but when you click the submit button it reloads the page. I've worked with php and html for a long time and actually have this exact code working in other portions of the site but for some reason it is breaking here. I would post a link to the page but it is in a members only area and you would need a bunch of cookies set to even get there. Any ideas are appreciated.
thanks,
Chris