Form Processing

How do I make a form go to a .php file for processing? Not all forms send emails, some may be searches in a database, updates to shopping carts, etc. etc. which will require their own code to run. I can’t see how to set the usual action and method options.

You can manipulate the exported code - just change the references in there :slight_smile:

Won’t the edited code get lost next time to page is edited and built?

How would you get the code to refer back to itself? Let’s say that you are on form.php - usually I do something along these lines:

//Check form for content, process, and then redirect to another page to day all is well
include "formprocess.php";
<!DOCTYPE html>
<form method="post" action="form.php">
echo "$errorMessage";
<input value="<?php echo $inputvalue;?>" name="name">
<input type="submit">

This allows the form page to process, return errors, all without a redirect. This allows error messages to be returned without using a second page, or using some kind of POST or GET. This is a simplistic example. I’ve worked on more complex forms where this is a far more efficient method than going form -> processing page -> back to form / on to confirmation (depending on result). It also allows more focussed feedback on why there may be a problem.