Asked  7 Months ago    Answers:  5   Viewed   37 times

When I use

<form method="post" enctype="text/plain" action="proc.php"> 

form data can not be sent to proc.php file properly. Why? What is the problem? Why I can't use text/plain encoding with post but I can use it with get method?




The answer is, because PHP doesn't handle it (and it is not a bug):

Valid values for enctype in <form> tag are:


The first is the default, the second one you need only when you upload files.

@Alohci provided explanation why PHP doesn't populate $_POST array, but store the value inside a variable $HTTP_RAW_POST_DATA.

Example of what can go wrong with text/plain enctype:


<form method="post" enctype="text/plain" action="file2.php">
<textarea name="input1">abc
<input name="input2" value="ghi" />
<input type="submit">





No way to distinguish what is the value of input1 and input2 variables. It can be

  • input1=abcrninput2=def, input2=ghi, as well as
  • input1=abc, input2=defrninput2=ghi

No such problem when using the other two encodings mentioned before.

The difference between GET and POST:

  • in GET, the variables are part of URL and are present in URL as query string, therefore they must be URL-encoded (and they are, even if you write enctype="text/plain" - it just gets ignored by the browser; you can test it using Wireshark to sniff the request packets),
  • when sending POST, the variables are not part of URL, but are sent as the last header in HTTP request (POSTDATA), and you can choose whether you want to send them as text/plain or application/x-www-form-urlencoded, but the second one is the only non-ambiguous solution.
Wednesday, March 31, 2021
answered 7 Months ago

 $Input = $_POST['element'];

 $FileToUpdate = "home.php";
 $fh = fopen($FileToUpdate , 'w') or die("can't open file");

 fwrite($fh, $Input);



The code above will do what you wish, but will overwrite the page (to append see this reference). But really I think you need to start from basics with a good PHP Tutorial.

Wednesday, March 31, 2021
answered 7 Months ago

One way to solve this is to reinforce your intentions by expliciting formmethod="post", like this:

<button type="submit" formmethod="post" formaction="add_user.php">Submit</button>
Friday, July 30, 2021
answered 3 Months ago

Following this guid helped me:

I think the reason I didn't see any notifications was that I didn't have an icon. After adding an icon to the notification, everything worked.


[Service(Exported = false), IntentFilter(new[] { "" })]
public class GcmNotificationService : GcmListenerService
    //More information on how to set different things from notification can be found here

    public override void OnMessageReceived(string from, Bundle data)
        var message = data.GetString("message");
        if (!string.IsNullOrEmpty(message))
            if (!NotificationContextHelper.Handle(message))

    private void SendNotification(string message)
        var builder = new Notification.Builder(this)

        var notification = builder.Build();
        var notificationManager = GetSystemService(Context.NotificationService) as NotificationManager;
        notificationManager.Notify(0, notification);
Saturday, July 31, 2021
answered 3 Months ago

Device tokens are not exactly unique per device; they're unique per operating system installation. So if a user buys a new device but does not restore from backup, then they'll get a new device token. And if a device is wiped, it will get a new device token, so the new user doesn't get the old user's messages.

In addition, there are different tokens returned for development apps using the sandbox and distribution apps using the production system.

Since a single user might have your app installed on multiple devices legally (iPhone and iPad, for instance), it will be much safer to have a many to many relationship between users and device tokens, to be on the safe side.

And since you mentioned Urban Airship, you might find that our alias feature helps for this sort of thing; you can assign a non-unique alias to the different tokens in our end, and then we'll keep track of the mapping between your users and their device tokens. See the registration and push parts of the UA documentation.

Edit: An update because I saw some more upvotes on this old answer. As of iOS 7, device tokens are unique for each application, even on the same device.

Monday, August 2, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :