If in a form i set
开发者_高级运维<input type = 'text' name = 'entry' value ='default_text'/>
And a user enters 'foo'
in place of 'default_text'
is this enough to make $_POST['entry']
become 'foo'
instead of 'default_text'
?
If not how do i make that happen?
If someone enters text into this input:
<input type = 'text' name = 'entry' value ='default_text'/>
PHP will receive the new text in $_POST/$_GET/$_REQUEST etc. and not the default (so, to answer your question, yes that is enough).
Yes, if the <input type="text" />
element is placed within a <form method="post">
element which also contains an <input type="submit" />
element to send the data:
<form method="post" action="/url/where/form/will/be/sent.php">
<input type = 'text' name = 'entry' value ='default_text'/>
<input type = 'submit' />
</form>
Of course, data will only be sent when the form is submitted. What happened wrong in your code?
精彩评论