as I do so that the form fields are not deleted without php

0
  • I have a form and I want that when the visitor enters their data and they "send" it will not be deleted if they are still there and can decide whether to send another email with the same data or start deleting them to write others, as achievement without php?

code:

<div class='contact-form-widget'>
    <div class='form'>
      <form name='contact-form'>
        <p/>
        <data:contactFormNameMsg/>
        <br/>
        <input class='contact-form-name' expr:id='data:widget.instanceId + &quot;_contact-form-name&quot;' name='name' size='30' type='text' value=''/>
        <p/>
        <data:contactFormEmailMsg/> <span style='font-weight: bolder;'>*</span>
        <br/>
        <input class='contact-form-email' expr:id='data:widget.instanceId + &quot;_contact-form-email&quot;' name='email' size='30' type='text' value=''/>
        <p/>
        <data:contactFormMessageMsg/> <span style='font-weight: bolder;'>*</span>
        <br/>
        <textarea class='contact-form-email-message' cols='25' expr:id='data:widget.instanceId + &quot;_contact-form-email-message&quot;' name='email-message' rows='5'/>
        <p/>
        <input class='contact-form-button contact-form-button-submit' expr:id='data:widget.instanceId + &quot;_contact-form-submit&quot;' expr:value='data:contactFormSendMsg' type='button'/>
        <p/>
        <div style='text-align: center; max-width: 222px; width: 100%'>
          <p class='contact-form-error-message' expr:id='data:widget.instanceId + &quot;_contact-form-error-message&quot;'/>
          <p class='contact-form-success-message' expr:id='data:widget.instanceId + &quot;_contact-form-success-message&quot;'/>
        </div>
      </form>
</div>
    
asked by codigofanatico 08.07.2018 в 02:58
source

1 answer

0

you can send the data by GET in the form,

<form name='contact-form' method='GET'>

And with javascript get the data of the URL:

   
    //prueba
    alert(getQueryVariable('product_id'))
    //funcion
        function getQueryVariable(variable) {
            // Estoy asumiendo que query es window.location.search.substring(1);
            var query = "product_id=32&cat_id=1&sessionid=123";
            var vars = query.split("&");
            //alert(vars);
            for (var i=0; i < vars.length; i++) {
                var pair = vars[i].split("="); 
                if (pair[0] == variable) {
                    return pair[1];
                }
            }
            return false;
        }
   
Get get taken from: ( How to get values from the URL (GET) in JavaScript? )

THIS WAY: With javascript you automatically assign the value to each field of the form.

    
answered by 09.07.2018 в 08:11