Jump to content

how Convert javascript variable into php variable


beboo002

Recommended Posts

Hello all

how Convert javascript variable into php variable.

my form is

======================================

<form action="xyz.php" method="post"  onsubmit="return validate();" name="form1" >

function test()  {

var x=document.getElementById("emailid").value;

<? ?>

}

</script>

<input name="emailid" type="text" class="input" value="" onBlur="test()" id="emailid"></td>

 

<input name="Submit3" type="submit" class="go" style="width: 180px;" value="Adevertise Now">

================================================

now how can i Put var x value into $x;

 

thanks

beboo

Link to comment
Share on other sites

logically no because var X doesn't exist till the page is rendered and thus it is no use to php that has already died upon rendering the  output. 

 

Now php variable $x can be used for a javaScript variable var x

 

The only real way is AJAX.

 

When the form is submitted the form inputs are placed in the $_POST array

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.