/    Sign up×
Community /Pin to ProfileBookmark

i was told on another part of this forum that i could clear a form with php and wasnt sure how to do it could anyone show me to the right direction?

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@mityaJun 08.2004 — Form-clearing is a client-side and post-HTML (as opposed to pre-html, like PHP) process and it's done in javascript.

On your clear button, add: onClick="clear();"

In your head section:

<Script language="javascript" type="text/javascript">

function clear() {

document.getElementById('formfieldname').value = '';

}

</script>
Copy linkTweet thisAlerts:
@daveyauthorJun 08.2004 — that wont work because the variables in the form wont be submitted to the next page
Copy linkTweet thisAlerts:
@mityaJun 08.2004 — Eh?

You asked how to clear a form, not handle it and deal with vars. Outline your situation and we can be more useful.
Copy linkTweet thisAlerts:
@daveyauthorJun 13.2004 — <table bgcolor="666666" id="login"><tr><td>

Login

<form action="getin.php" method="post" target="content" name="form">

Username:<br> <input type="text" name="username" size="10" value=""> <br>

Password:<br> <input type="password" name="password" size="10" value=""><br>

<INPUT TYPE="submit" value="submit" class="black">

</form>

and after the form is submitted i need it to clear
Copy linkTweet thisAlerts:
@MstrBobJun 13.2004 — o.O? When you click submit, the form is going to go to getin.php You won't see a form, as the browser will be at getin.php Unless getin.php is the page you just gave us, in which case the form will be cleared anyway.
Copy linkTweet thisAlerts:
@daveyauthorJun 14.2004 — getin.php loads in an iframe and the form is in a different one
×

Success!

Help @davey spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...