Simulating Form Submissions - Noob question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jkearns
Forum Newbie
Posts: 3
Joined: Sat Nov 25, 2006 9:01 pm

Simulating Form Submissions - Noob question

Post by jkearns »

You can probably tell from the Subject Line that I don't even know enough to phrase my question correctly.

I would like to add 250 users to a Wordpress blog of mine. The code to add a single user via a form is below. Assuming I could write the code to take names, passwords, etc., from a CSV file, how do I simulate submitting the form 250 times?

Thanks very much!
Jerry

Code: Select all

<div class="wrap">
<h2>Add New User</h2>
<p>Users can <a href="http://www.baklava.org/blog/wp-register.php">register themselves</a> or you can manually create users here.</p><form action="" method="post" name="adduser" id="adduser">
  <input type="hidden" name="_wpnonce" value="0df235c514" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-admin/users.php" />  <table class="editform" width="100%" cellspacing="2" cellpadding="5">

    <tr>
      <th scope="row" width="33%">Nickname      <input name="action" type="hidden" id="action" value="adduser" /></th>
      <td width="66%"><input name="user_login" type="text" id="user_login" value="" /></td>
    </tr>
    <tr>
      <th scope="row">First Name </th>
      <td><input name="first_name" type="text" id="first_name" value="" /></td>
    </tr>

    <tr>
      <th scope="row">Last Name </th>
      <td><input name="last_name" type="text" id="last_name" value="" /></td>
    </tr>
    <tr>
      <th scope="row">E-mail</th>
      <td><input name="email" type="text" id="email" value="" /></td>
    </tr>

    <tr>
      <th scope="row">Website</th>
      <td><input name="url" type="text" id="url" value="" /></td>
    </tr>
    <tr>
      <th scope="row">Password (twice) </th>
      <td><input name="pass1" type="password" id="pass1" />
      <br />

      <input name="pass2" type="password" id="pass2" /></td>
    </tr>
  </table>
  <p class="submit">
    <input name="adduser" type="submit" id="adduser" value="Add User &raquo;" />
  </p>
  </form>
</div>
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

What you're trying to do is better accomplished by importing the data directly into the database. What kind of user info do you have right now?
jkearns
Forum Newbie
Posts: 3
Joined: Sat Nov 25, 2006 9:01 pm

Post by jkearns »

That makes sense. Unfortunately for me, I know less about importing into databases than I do about PHP. Any simple example might be enough for me to get started and hopefully not do too much damage. ;)

The only user information I need for users is Nickname, first name, last name, email, password (twice), and website.

The description of the database is at http://codex.wordpress.org/Database_Description

Thanks in advance!
jkearns
Forum Newbie
Posts: 3
Joined: Sat Nov 25, 2006 9:01 pm

Post by jkearns »

The database supported is "MySQL version 3.23.23 or greater".

Actually, the real database doc is at http://codex.wordpress.org/Database_Description20
(Finding this may give me a starting point!)
Post Reply