manalnor Posted March 2, 2011 Share Posted March 2, 2011 Hello dear friends, say i've form with 2 variables which i want to post to another file file 1 <script type="text/javascript"> // <![CDATA[ $(document).ready(function(){ $('#loader').hide(); $('#inner').children().click(function(){ var a = $(this).attr("name"); $.post("rating.php?value="+a,{}, function(response){ $('#inner').fadeOut(); $('#inner').html(unescape(response)); $('#inner').fadeIn(); setTimeout("hideMesg();", 2000); }); }); }); function hideMesg(){ $('.rating_message').fadeOut(); $.post("rating.php?show=1", {}, function(response){ $('#inner').html(unescape(response)); $('#inner').fadeIn('slow'); }); } // ]]> </script> this will post the following ( the value of name ) <div class="rating_dis" name="<?php echo $k?>" id="<?=$id?>"> </div> but i want it also to post the value of the (id) here is the second file which should get the name if($_REQUEST['value']){ $name = $_REQUEST['value']; $query = "insert into rating (rated, channelid) values ('$name', '$idz')"; mysql_query( $query); } so the problem is how to send from file 1 to file 2 both the (name) and (id) how to double this ? var a = $(this).attr("name"); $.post("rating.php?value="+a,{}, to be also var a = $(this).attr("id"); $.post("rating.php?any="+a,{}, then i can get it from file 2 easily get both. thank you :'( Link to comment https://forums.phpfreaks.com/topic/229423-post-2-variables/ Share on other sites More sharing options...
btherl Posted March 2, 2011 Share Posted March 2, 2011 Try this: var a = $(this).attr("id"); var b = $(this).attr("name"); $.post("rating.php?any="+a+"&value="+b,{}, Then you can use both $_REQUEST['value'] and $_REQUEST['any'] in rating.php Link to comment https://forums.phpfreaks.com/topic/229423-post-2-variables/#findComment-1182065 Share on other sites More sharing options...
manalnor Posted March 2, 2011 Author Share Posted March 2, 2011 @btherl thank you so much , it works perfect now and i've understood it Link to comment https://forums.phpfreaks.com/topic/229423-post-2-variables/#findComment-1182084 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.