TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,230
  • Total Topics: 21,353
  • Online today: 867
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online

What type of block should I use for this code?

Started by ApplianceJunk, July 26, 2008, 02:58:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ApplianceJunk

Using SMF 1.1.5 and TP v0.9.8

I'm using this code in a phpbox for the search box at the top of our site @ ApplianceJunk.com and it works great.

global $context, $settings, $options, $txt , $scripturl;

echo '
<form  accept-charset="', $context['character_set'], '" action="', $scripturl, '?action=search2" method="post" style="padding: 0; text-align: center; margin: 0; margin-bottom: 5px;">
<br />
<table>
<tr>
  <td align="center"><input type="text" name="search" value="" size="31" maxlength="100"></td>
<td><input type="image" src="http://www.appliancejunk.com/imgs/search.gif" alt="Search" width="20" height="16">
<input type="hidden" name="advanced" value="0" />
  </td>
</tr>
</table>

<table align="center">
<tr>
  <td style="font-family:Arial; font-size:10pt; color:#A7A7A7; padding:1; padding-left:15; padding-bottom:0;" height="5">Search ApplianceJunk.com</td>         
</tr>
</table>

</form><p></p>';



I edit the code by adding this

value="Search ApplianceJunk.com" onfocus="if
(this.value==this.defaultValue) this.value='';"


That put the "Search ApplianceJunk.com" in the text box and when you click the text box to type it removes it.

With that code added I end up with this.

global $context, $settings, $options, $txt , $scripturl;

echo '
<form  accept-charset="', $context['character_set'], '" action="', $scripturl, '?action=search2" method="post" style="padding: 0; text-align: center; margin: 0; margin-bottom: 5px;">
<br />
<table>
<tr>
  <td align="center"><input type="text" name="search" value="Search ApplianceJunk.com" onfocus="if
(this.value==this.defaultValue) this.value='';" size="31" maxlength="100" style="color:#A7A7A7"></td>
<td><input type="image" src="http://www.appliancejunk.com/imgs/search.gif" alt="Search" width="20" height="16">
<input type="hidden" name="advanced" value="0" />
  </td>
</tr>
</table>

</form><p></p>';


The last code seems to work fine in my editor, First Page 2006.

But when I put the code in a phpbox I get this error in the box.

QuoteParse error: syntax error, unexpected '<' in /home/applianc/public_html/forums/Sources/Load.php(1797) : eval()'d code(35) : eval()'d code on line 1

When I put the edited code in a scriptbox it looks like it's going to work, but the search button does not work.

Being the search button is php I can kind of see why, but I don't understand what I should do to get my code to work.

Seems I have a combination of php and something else with this code that I'm trying to add.

value="Search ApplianceJunk.com" onfocus="if
(this.value==this.defaultValue) this.value='';"


I have been working on this for about four hours and it's starting to make me  :uglystupid2:

Would love to hear some thoughts on my problem.

Thanks,

JPDeni

You have a problem with quotes. It should work if you change your code to


value="Search ApplianceJunk.com" onfocus="if
(this.value==this.defaultValue) this.value=\'\';"

ApplianceJunk

That works great!

It would have been many more hours before I would have got that one on my own.

Thank you,
AJ

JPDeni

Those are the hardest problems to find. I've gone hours with things like that myself.

Marking it solved.

This website is proudly hosted on Crocweb Cloud Website Hosting.