Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have requirement More then one field in registration form which i have build as above but there is some problem and it will not insert in wp-post table.

                                        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(); ?>

I am referred codex but no one idea about more then one field insert as post so suggest me if you have any ans.

Thank You.

share|improve this question
    
I would recommend you convert these to user meta fields instead of inserting as post. –  Angela Jul 26 '13 at 12:34
    
@Angela can you suggest me any example ? –  Ravi Parmar Jul 26 '13 at 12:43
    
Could you please reformat your code? It's completely off and tough to read (hit the "edit" link on the bottom left of your question). Thanks. –  kaiser Jul 26 '13 at 13:29
    
Oh, btw, as I've seen the wordpress.com: Is this question really about wordpress.com? –  kaiser Jul 26 '13 at 13:29
add comment

1 Answer

Instead of treating the content as a post. It's best to let them be users as they originally were. So you should hook custom user meta field into the registration form instead. Please see this article for information on how to do that http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.