I am a newbie to WordPress. I've created a custom form in WordPress and I need to know where to put the WPDB PHP code to save my form data.
I tried putting it directly in my page but that didn't work.
All of the research I've looked up says not to enter it in the function file so where do I put it?
Here is the code I put in my page:
Form Code
<form id="myForm" name="myform">
<select id="brandSel" size="1">
<option selected="selected" value="">-- Select Brand --</option>
<option>Abba</option>
<option>AG Hair</option>
</select>
<input type="submit" value="submit" />
</form>
PHP Code
<?php
global $wpdb;
$inputValue = $_POST['newValue'];
$wpdb->insert(
'catalog',
array(
'brandSel' => $inputValue
),
array( '%s' // if the field type is string )
);
?>