Your question is somewhat vague... You tagged your question with [javascript]
yet you don't want to use onclick
, and you mentioned PHP in the title.
Your comment to @webbiedave, "Am I able to use onclick within a block?", suggests that you want this to happen on the client side, but PHP only runs on the server side.
If you edit your question and post the code you're using, I can be of much more help. But there's two basic ways of doing this. Using PHP alone (server side), it would look like:
<?php
$textbox_value = 'submit';
if(isset($_POST['clear']))
{
$textbox_value = '';
}
?>
<input name="text" value="<?php ech $textbox_value; ?>" />
<input type="sumbmit" name="clear"/>
The second way is to use javascript, and would look more like:
<input name="text" value="some value" id="someUniqueIDYouMakeUp" />
<input type="sumbmit" name="clear" onclick="document.getElementById('someUniqueIDYouMakeUp').value='';return false;" />