I am merely making an attempt to course of information from an html type into my wordpress database by means of php. I’ve tried a number of instances to get the information inserted however have had no luck.
The setup is as follows:
Database identify: seanmcve_AssociationNation
Desk: affiliation
The row I need information entered in: association_first_name
I’ve setup a web page template referred to as form_processing_template.php.
<?php
/*
Template Identify: type processing template
*/
?>
<type motion="" methodology="submit">
<h4><sturdy>What's the authorized identify of your affiliation?</sturdy></h4>
<enter identify="legalName" sort="textual content" placeholder="Affiliation Identify" />
<enter sort="submit" identify="submit" worth="Submit" />
</type>
<?php
If($_POST['submit']) {
// run validation when you're not doing it in js
$legalname=$_POST['legalName'];
echo $legalname;
$wpdb->insert('affiliation',
array(
'association_first_name' => '$legalname'
),
array(
'$s',
)
);
}
?>
<?php x_get_view( x_get_stack(), 'wp', 'web page' ); ?>
I am echoing the variable simply to verify it is appropriate and dealing (which is working) I have been referencing the wpdb class reference web page and nonetheless have had no luck. Can anybody level me in the suitable course?