first of all sorry for my English. :/ I'll try to be clear. :)
I'm using a CMS and I have two different forms (by two different plugins):
- Form in PHP (plugin for registration users);
- Form in JavaScript (plugin for a booking system).
I need to get (or post) values from php form to javascript form if these values already exist.
So, example:
- An user goes to "register" page and sets his data in every field (in php form);
- After this user goes to "booking" page, where there is another form (js) with the same fields of the first form and new fields to set: he hasn't to repeat the data in the same fields, they should be printed (echo) automatically.
This is form 1 (PHP), only 3 fields:
And this is form 2 (JavaScript), that repeats the 3 fields and contains new fields. I would to echo the values of those fields automatically:
Code PHP Register Form (1):
<form name="registerform" id="registerform<?php $template->the_instance(); ?>" action="<?php $template->the_action_url( 'register' ); ?>" method="post">
<p> <label for="iCountry<?php $template->the_instance(); ?>"><?php _e( 'Select Your Country', 'theme-my-login' ) ?></label> <select name="iCountry" id="iCountry<?php $template->the_instance(); ?>" class="input"><option value="IT">Italy</option><option value="US">USA</option><option value="DE">Germany</option></select> </p>
<p> <label for="user_login<?php $template->the_instance(); ?>"><?php _e( 'First Name' ); ?></label> <input type="text" name="user_login" id="user_login<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_login' ); ?>" size="20" /> </p>
<p> <label for="user_email<?php $template->the_instance(); ?>"><?php _e( 'E-mail' ); ?></label> <input type="text" name="user_email" id="user_email<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_email' ); ?>" size="20" /> </p>
<?php do_action( 'register_form' ); ?>
<p id="reg_passmail<?php $template->the_instance(); ?>"><?php echo apply_filters( 'tml_register_passmail_template_message', __( 'A password will be e-mailed to you.' ) ); ?></p>
<p class="submit"> <input type="submit" name="wp-submit" id="wp-submit<?php $template->the_instance(); ?>" value="<?php esc_attr_e( 'Register' ); ?>" /> <input type="hidden" name="redirect_to" value="<?php $template->the_redirect_url( 'register' ); ?>" /> <input type="hidden" name="instance" value="<?php $template->the_instance(); ?>" /> <input type="hidden" name="action" value="register" /> </p> </form>
Code JS form (2):
case 'select':
/*
* Select field.
*/
HTML.push(' <div id="DOPBSPCalendar-form-field-warning'+ID+'_'+formField['id']+'" class="dopbsp-warning-info DOPBSPCalendar-hidden">');
HTML.push(' <a href="javascript:void(0)" class="dopbsp-icon"></a>');
HTML.push(' <div class="dopbsp-message">'+formField['translation']+' '+methods_form.text['required']+'</div>');
HTML.push(' </div>');
HTML.push(' <label for="DOPBSPCalendar-form-field'+ID+'_'+formField['id']+'">'+formField['translation']+(formField['required'] === 'true' ? ' <span class="dopbsp-required">*</span>':'')+'</label>');
HTML.push(' <select name="DOPBSPCalendar-form-field'+ID+'_'+formField['id']+(formField['multiple_select'] === 'true' ? '[]':'')+'" id="DOPBSPCalendar-form-field'+ID+'_'+formField['id']+'" value=""'+(formField['multiple_select'] === 'true' ? ' multiple':'')+'>');
for (j=0; j<formField['options'].length; j++){
formFieldOption = formField['options'][j];
HTML.push('<option value="'+formFieldOption['id']+'">'+formFieldOption['translation']+'</option>');
}
HTML.push(' </select>');
break;
case 'text':
/*
* Text field.
*/
HTML.push(' <div id="DOPBSPCalendar-form-field-warning'+ID+'_'+formField['id']+'" class="dopbsp-warning-info DOPBSPCalendar-hidden">');
HTML.push(' <a href="javascript:void(0)" class="dopbsp-icon"></a>');
HTML.push(' <div class="dopbsp-message">'+formField['translation']+' '+(formField['is_email'] === 'true' ? methods_form.text['invalidEmail']:methods_form.text['required'])+'</div>');
HTML.push(' </div>');
HTML.push(' <label for="DOPBSPCalendar-form-field'+ID+'_'+formField['id']+'">'+formField['translation']+(formField['required'] === 'true' ? ' <span class="dopbsp-required">*</span>':'')+'</label>');
HTML.push(' <input type="text" name="DOPBSPCalendar-form-field'+ID+'_'+formField['id']+'" id="DOPBSPCalendar-form-field'+ID+'_'+formField['id']+'" value="" />');
break;
Any suggestions?
Thanks in advance!