Home >Backend Development >PHP Problem >How to clear text box in php

How to clear text box in php

藏色散人
藏色散人Original
2020-09-02 10:53:512498browse

php method to clear the text box: 1. Use the onclick handler of the submit button in javascript; 2. Use the php code [if(count($_post)>0){...}] method Clear the text box.

How to clear text box in php

Recommended: "PHP Video Tutorial"

php clear text box

Specific question:

Is there a way to remove text from a text box using a submit button?

I don't want to delete the text in all the boxes on the form.

I don't want to remove the element's text "onclick".

I need code to clear a textbox, initiated from within a block.

For example

<input name="text" value="submit" />
<input type="sumbit"/>
<?php 
   if($_POST[&#39;submit&#39;] == "submit")
{
  //clear text box with name "text"
}
?>

Solution:

You can do it in two ways:

在javascript中使用submit按钮的onclick处理程序

Use PHP

if(count($_post)>0)
{
$请求[&#39;text&#39;]=$获取[&#39;text&#39;]=$发布[&#39;text&#39;]=&#39;&#39;;
}

The above is the detailed content of How to clear text box in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn