Jump to content

Saving pages from a form


ZionBludd
 Share

Recommended Posts

I am wanting to save pages via a form input. I've done a fair amount of searching, and am struggling to find a working solution. Primarily my knowledge falls under web design, and this web development (PHP, PW, etc) is new territory for me.

If i was starting below, how would I tie it all together with a form? 

$p = new Page(); // create a new page 
$p->template = 'reviews_template'; // choose template 
$p->parent = wire('pages')->get('/gyms/'); // choose parent page 
$p->title = $sanitizer->text($input->get->title); // clean user input and set title 
$p->a_field = $sanitizer->text($input->get->field); // clean user input and set a custom field 
$p->save(); // save the page
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...