Need Help Returning Data From HTML Form on New HTML Page using JavaScript -


i'm having bit of trouble i'm sure of laugh at.

i have form built 1 html page (contact.html), , need have second html page (submit.html) display information entered form using javascript. here form code page 1:

<form name="contact" method="post" action="submit.html">     <p>first name: *</p><input type="text" name="first">     <p>last name: *</p><input type="text" name="last">     <p>cell phone number:</p><input type="text" name="number">     <p>e-mail address: *</p><input type="text" name="address">     <p>comment: *</p>     <p><textarea name="comments" cols="25" rows="5"> </textarea></p>     <p><input type="submit" value="submit"></p>     </form> 

can please point me in right direction? i'm literally brand new javascript, don't understand of of yet.

thank in advance, , please take easy on me!

you can't post parameters using javascript - post parameters going through headers in hidden way , have set second page server side page (php,asp.net etc...) in php example can post parameters using this:

$first_value = $_post['first']; 

if still want use javascript can change method of form "get" (method="get") , parameters in url - , in other page can use regexp take params using function:

function getqsparam(key,target){     var value = '';     if(!target){         target = location.href;     }      var pattern = key + '=([^&]+)';     var o_reg = new regexp(pattern,'i');     var matches = o_reg.exec(target);     if(matches && matches[1]){         value = matches[1];     }      return value; } 

so if url that: submit.html?first=karl&last=marx&... can take parameters using function that:

var first_value = getqsparam('first'); var last_value = getqsparam('last'); 

and on...


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -