This should be a rather simple question to answer. I want to include a field of data using $_POST that is not inputted by the user in an <input name=" "> text box. Is there anyway to manually add a field to $_POST without using input?

Example:

<form action="<? echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>
<tr><td>Account Type:</td><td>One</td></tr>
//is this possible?
//<?echo $_POST['type'] = 1;?>
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30"></td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="subjoin" value="Submit!"></td></tr>
</table>
</form>
<input name="hiddenfield" type=hidden value='somevalue'>

User will not able to view the field but still it will be posted along with other form elements.

Awesome, thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.