HI all,

I have make two form. one in which i will fill value then is will go in next page after submitting with $_Post . But i need this value in my javascript code in next page .

So how i can fetch this value in my javascript code. But this value will come from input text field

because on next page in javascript i want to put some validation on that value . So how i can do this. i need this value in my javacript code . please help me to fetch this $_POST in my javascipt code.


8 Years
Discussion Span
Last Post by almostbob

expanding on AkonKagva's answer

<script type='text/javascript'>
var validatethis="<?php echo $_post['input1']; ?>";
// bla bla bla bla

HI ,
I have tried to write my variable which i am fetching it from my last form in javascritpt but it is not showing value in alert box.

I have write my code like this:-

<script type="text/javascript">
var myval="<?php echo $_POST['adult']; ?>";

in alert box it is not giving value of variable myvar rather than it is giving <?php echo $_POST; ?> this in alert box . But i want value return by this.

so please help me how i can show this value in javascript code.



is the file being parsed as php
that is, is it on a server, either localhost with php installed (wamp, a phpIDE, or similar)
or on your remote server with php installed
and named filename.php so that the php parser knows to look at it.htm .html on your local machine without php installed will not work

Votes + Comments
Gagan played
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.