Editing a PHP Form

Home Forums Languages PHP & MySQL Editing a PHP Form

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Vera 1 year, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13976

    juniper
    Participant

    If I’m making a PHP form, how can I limit so that only an IP can only send the form once? To prevent double posting, etc?

    Also, is there a way to send the form to multiple emails?

    #14956

    Vera
    Participant

    Preventing double posting:

    1) submit the form via AJAX

    Basically you would not let the form do any more submission until, you receive an OK message from the server. And after you do, you clear the form field before enabling submission again.

    2) using PHP (or other server side coding)

    generate a unique random value for that hidden field, and when the form is submitted first check that the value of said form is unique (you’d need to save previous values in a DB for example).

    Personally I’d use 1. 2 is more secure I guess, but in hindsight seems like too much of a hassle.

    Send email to multiple addresses

    1) http://php.net/manual/en/function.mail.php use extra headers to add more emails to bcc

    2) have a for loop, where you go through the list of emails and use mail() for each of these.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.