我有要求More then one field 在注册表格,我已经建立了如上所述,但有一些问题,它将不会插入到wp后表
if(isset($_POST[\'submit\']) ){
global $wpdb; // to connect a database
//store array arg in database
$custompost = array(\'post_status\' => \'publish\', \'post_type\' => \'post\', \'post_author\' => $user_ID,
\'ping_status\' => get_option(\'default_ping_status\'), \'post_parent\' => 0,
\'menu_order\' => 0,\'post_content_filtered\' => \'\', \'post_excerpt\' => \'\', \'import_id\' => 0,
\'post_name\' => $_POST[\'name\'], \'post_designation\' => $_POST[\'designation\']
);
//var_dump($id);
var_dump($custompost);
$postId = wp_insert_post($custompost);
}
?>
<div id="postbox">
<form id="new_post" name="new_post" action="" method="post" >
<table border="0">
<tr>
<td><h2>Registration Form</h2></td>
</tr>
<tr><td><label for="name">Name:</label></td>
<td><input type="text" id="name" value="" tabindex="1" size="20" name="name" />
</td></tr>
<tr>
<td><label for="designation">Designation/Class:</label></td>
<td><input type="text" id="designation" value="" tabindex="1" size="20" name="designation" /></td>
<td><label for="sex">Sex:</label>
<input type="radio" name="gender" value="male">Male
<input type="radio" name="gender" value="female">Female</td>
</tr>
<tr>
<td><label for="organization">Organization:</label></td>
<td><input type="text" id="organization" value="" tabindex="1" size="20" name="organization" /></td>
</tr>
<tr>
<td><label for="postaladdress">Postal Address</label></td>
<td><textarea id="postaladdress" tabindex="3" name="postaladdress" cols="25" rows="3"></textarea></td>
</tr>
<tr>
<td><label for="telephoneoffice">Telephone Office:</label></td>
<td><input type="text" id="telephoneoffice" value="" tabindex="1" size="20" name="telephoneoffice" /></td>
<td><label for="mob">Mob:</label>
<input type="text" id="Mob" value="" tabindex="1" size="20" name="mob" /></td>
</tr>
<tr>
<td><label for="emailaddress">Email Address:</label></td>
<td><input type="text" id="emailaddress" value="" tabindex="1" size="20" name="emailaddress" /></td>
</tr>
<tr>
<td><label for="academicqualification">Academic Qualification:</label></td>
<td><input type="text" id="academicqualification" value="" tabindex="1" size="20" name="academicqualification" /></td>
</tr>
<tr>
<td><label for="experience">Experience Teaching / Industry:</label></td>
<td><input type="text" id="experience" value="" tabindex="1" size="20" name="experience" /></td>
</tr>
<tr>
<td><label for="titleofpaper">Title of Paper(s)</label></td>
<td><textarea id="titleofpaper" tabindex="3" name="titleofpaper" cols="25" rows="3"></textarea></td>
</tr>
<tr>
<td><label for="participationas">Participation as:</label></td>
<td><select>
<option value="faculty">Faculty</option>
<option value="research">Research Scholar</option>
<option value="under">Under Graduate Student</option>
<option value="industrial">Industrial Participant</option>
<option value="participant">Participant Outside India</option>
</select></td>
</tr>
<tr align="center">
<td colspan="2"><button type="submit" name="submit">Submit</button>
<input type="hidden" name="submitted" id="submitted" value="true" /></td>
</tr>
</table>
</form>
</div><!-- end #content -->
<?php get_footer(); ?>
我是抄本,但没有人知道更多的字段插入作为post,所以建议我,如果你有任何ans。
非常感谢。