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.

thanks,
gagan

Recommended Answers

All 5 Replies

I made it simply using echo $_POST; why no ?

expanding on AkonKagva's answer

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

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']; ?>";
	      alert(myval);
</script>

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.

thanks

Post your complete 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

commented: Gagan played +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.