I'm trying to create one Plugin. I'm very new for this. For that I want to create N number of fields. So If I click Add button, text field should create dynamically with random id (without duplicate).
See my coding,
<?php
add_action('admin_menu', 'add_karsho');
function add_karsho()
{
add_options_page('Add Text', 'Add Text', 'manage_options', 'functions','karsho');
}
function karsho()
{
?>
<div class="wrap">
<h2>Add Text</h2>
<input type="button" value="Add" >
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p><strong>Text 1:</strong><br />
<input type="text" name="text-1" size="45" value="<?php echo get_option('text-1'); ?>" />
</p>
<p><input type="submit" name="Submit" value="Store Options" /></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="text-1" />
</form>
</div>
<?php
}
?>
This coding working very fine for that field 'text-1'. If I click, 'Add' button, number field should increase one by one.
Help me...
Aucun commentaire:
Enregistrer un commentaire