Q1A. Do I need to add "enctype=" on my following keyword search form that posts to the same page ?
Q1B. Is it really necessary to add enctype ? The form processor will be in php.
Q1C. Notice the "action=". Does it make any difference if the "action=" contains a url that has been urlencode() or not ?
<form method='POST' name='search' id='search' action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']).'?tbl='.urlencode($tbl).'&col='.urlencode($col).'&page='.urlencode($page);?>">
<label for='url'>Url</label><br>
<input type='url' name='url' id='url' maxlength="100" required><br>
<label for='anchor'>Anchor</label><br>
<input type='text' name='anchor' id='anchor' required><br>
<label for='anchor'>Username</label><br>
<input type="text" pattern="[a-zA-Z0-9]{5,8}" title="Type 5 to 8 alphanumeric characters">
<label for='email'>Email</label><br>
<input type='email' name='email' id='email' maxlength="100" required><br>
Q1D. Is it really necessary to add enctype if the form was submitting to another page on same domain/website via POST method ?
Q2. If I use "application/x-www-form-urlencoded" then would this be a doule urlencoding in any way since I have already urlencoded the destination url ?
<form method='POST' name='search' id='search' action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']).'?tbl='.urlencode($tbl).'&col='.urlencode($col).'&page='.urlencode($page);?>">
Q3. If I use:
<form method='POST' name='search' id='search' action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']).'?tbl='.urlencode($tbl).'&col='.urlencode($col).'&page='.urlencode($page);?>">"
Then would I have to decode the submitted data on the serverside or what ?
Q4. Anything else I need to know ?
Only if you want a non-default value for it. Which you probably don't want to do unless you are using a file input.
The URL may or may not be valid.
Submitting to another page on the same domain makes absolutely no difference as to if you should specify
enctype
or not.The attribute describes how the request body will be encoded. It does nothing to the URL.
No. PHP will decode query string parameters when populating
$_GET
.