0

Hi everyone, can you help me understand the logic why I can't access one of my the items in POST.
Here is my form:

<form action="insert2.php" method="POST">

<table border="0">               
            <tr>
                    <td width="40%"><b>Date:</b></td>
                    <td width="60%"> <input type='text' name="today" placeholder='<?php echo $today ?>' disabled='disabled'> </td>
            </tr>

            <tr>
                    <td width="40%"><b>User ID:</b></td>
                    <td width="60%"> 
                    <input type="text" name="userid" placeholder='<?php           
                    echo $_GET['message'];  
                    ?>'>
                    </td>
            </tr>
            </table>
            <br>
            <br>

                <font color="#990000" size="5px">    [ Choose the appropriate status, and edit the text field for the appropriate action ] </font>

                    <br>
                    <br>


            <table border="0">   
</FORM>

When I var_dump($_POST); it says that ["userid"]=> string(0) while in fact, it has a placeholder value and the value is displayed, but why I can't pass it?

Any help would be very much appreciated. Thankyou.

Edited by ms061210: incorrect title

3
Contributors
2
Replies
13
Views
3 Years
Discussion Span
Last Post by aravinda.dani
1

the "placeholder" attribute (while not supported in all browsers) is a fancy way of giving a "hint" to the user as to what is supposed to go into the field. A place holder is usually something like "First Name" or "Phone Number" so when the user clicks the field, they know what they are supposed to type there. The value there ("First Name", etc..) is not the actual value of the field. If you want a default value passed in, you will need to set the value of the input, but then your placeholder would not be visibile unless the value is empty.

If you you want the GET to be passed to the form, instead of:
placeholder="<?echo ($_GET['message']);?>"
use
value="<?echo ($_GET['message']);?>"

Hope that helps!

Ryan

Votes + Comments
Yes. It helps. A lot :) Thank you so much :)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.