I’m trying to create a custom submit form on wordpress
I’m using the wp page template from the twentyfourteen theme and put my code inside of the
<div id="content" class="site-content" role="main">
$wpdb->insert('wp_table',array (
'db_column' => $inputtext,
)
);
It works, but every time the page loads, it also submit blank data into my wp_table.
how to avoid this? I just want to input data using the submit button.
You can avoid submitting blank data into the wordpress table by using
isset
in phpSee this one ..Hope it was helpful
Before submitting your data, you must make sure it is not empty.
This is the right way to go:
This code snippet is commonly seen in WordPress plugins or themes.