Question on Code Error for a Search Box
Posted: Tue Aug 11, 2009 3:29 pm
Hi I'm new here, and trying to debug a new site I'm working on. Seems like this is a REALLY helpful forum - so maybe someone kind enough to tell me my error. The code is for a search box on an HTML/PHP site...and it's set up to have default text...and 'onclick', then it's supposed to remove the default text and let the user type their search.
However, dreamweaver is giving me huge 'Error' message, saying
<?> Invalid markup...Markup invalid because it contains a duplicate attribute.
<input...Remove the duplicate attribute
Here's the section...and I've bolded the part that Dreamweaver says has an error.
---------------
<form action="index.php" method="post"><span class="searchform">
<label></label>
</span>
<div align="right">
<input name="search" type="text" class="searchboxtext" id="search"
<?if ($search !=""){?>
value="<?=$search?>" onfocus="if(this.value == 'Style, Brand, Color, etc') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Style, Brand, Color, etc';}"
<?}else{?>
value="Style, Brand, Color, etc" onfocus="if(this.value == 'Style, Brand, Color, etc') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Style, Brand, Color, etc';}"
<?}?>
/>
<input type="image" src="<?=$root_http?>images/searchbutton.jpg" align="middle" /><span class="searchform"> </span></div>
</form>
-----------------
I would LOVE it if someone could help me learn what's wrong here, if you spot which attribute is duplicate...or how I can make the error go away while still doing on the 'on click' stuff. I'm trying to teach myself and some stuff is easy, but this one is tricky for me. Thank you so much.
Best,
Mike
However, dreamweaver is giving me huge 'Error' message, saying
<?> Invalid markup...Markup invalid because it contains a duplicate attribute.
<input...Remove the duplicate attribute
Here's the section...and I've bolded the part that Dreamweaver says has an error.
---------------
<form action="index.php" method="post"><span class="searchform">
<label></label>
</span>
<div align="right">
<input name="search" type="text" class="searchboxtext" id="search"
<?if ($search !=""){?>
value="<?=$search?>" onfocus="if(this.value == 'Style, Brand, Color, etc') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Style, Brand, Color, etc';}"
<?}else{?>
value="Style, Brand, Color, etc" onfocus="if(this.value == 'Style, Brand, Color, etc') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Style, Brand, Color, etc';}"
<?}?>
/>
<input type="image" src="<?=$root_http?>images/searchbutton.jpg" align="middle" /><span class="searchform"> </span></div>
</form>
-----------------
I would LOVE it if someone could help me learn what's wrong here, if you spot which attribute is duplicate...or how I can make the error go away while still doing on the 'on click' stuff. I'm trying to teach myself and some stuff is easy, but this one is tricky for me. Thank you so much.
Best,
Mike