• Hi all,

    What I’m trying to achieve is to run some PHP code after the user submits a HTML form. The PHP is to send the contents of the form to a specific database table, if that makes any difference 🙂

    So I’ve tried so far to add the PHP as a template, but when setting the page to use that template it returns an error stating that the value entered for an integer (which is what the database is waiting for) is invalid, the value is blank as this all happens before the user gets a chance to enter the data into the form (or even see the form) as I’m guessing this php runs instantly when the page is loaded.

    So instead I tried this: (the rest of the form is present, I just haven’t copied it in)

    <form name="insert" action="/wp-content/themes/catch-evolution/db_send.php" method="POST" >

    After submitting the form this says that “the requested URL *insert above path* can’t be found on this server”.

    I’ve also tried it as

    <form name="insert" action="db_send.php" method="POST" >

    But this has the same result.

    Does anybody know the best way to do this please? I’ve tried searching existing threads on here but can’t find an exact answer.

    New to wordpress so please keep answers simple to understand 🙂

    Thanks in advance,
    azibux1

Viewing 1 replies (of 1 total)
  • Thread Starter azibux1

    (@azibux1)

    I’ve now put the php file in the root of the wordpress folder and it seems to have run without any errors at the wordpress side of things

    Does appear to have caused an issue with the database but that’s a separate issue haha

Viewing 1 replies (of 1 total)
  • The topic ‘Processing some PHP after submitting a HTML form’ is closed to new replies.