is it this type of post possible?

Discussion in 'PHP' started by macaela, Sep 3, 2011.

  1. #1
    hi is it possible to post a variable like this either with javascript or php i tried here with javascript but didnt work is there a similiar way of doing with php??

    query.php
    <?php
    include("../../includes/config.php");
    mysql_connect($db_address, $db_username, $db_password);mysql_select_db($db_name) or die(mysql_error());
    $fid = $_GET['fid'];	
    $fid = mysql_real_escape_string($fid);
    $query10 = "SELECT * FROM films WHERE (film_id = '$fid')";	
    $qry_result10 = mysql_query($query10) or die(mysql_error());
    while($row10 = mysql_fetch_array($qry_result10))	
    {	$urlfid="http://www.onfilm.biz/streaming/home/".$row10['client']."/".$row10['client_office']."/".$row10['filename'].".mp4";?>		
    <a class="hofwhite14" href="#" onclick="loadNplay('<?php echo $urlfid; ?>')"><u></u>Property Film</u></a>
    <?php	}mysql_close();
     //EDIT 290510
    ?>
    
    <script type="text/javascript">
    
    var video= $urlfid;
    $.post('indextest.php', {urlfid:video});
    
    </script>
    Code (markup):

     
    macaela, Sep 3, 2011 IP
  2. babushkyn

    babushkyn Member

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    2
    Trophy Points:
    26
    #2
    <script type="text/javascript">
    
    var video= <?php echo $urlfid; ?>;
    $.post('indextest.php', {urlfid:video});
    
    </script>
    HTML:
    Is it what you're looking for?
     
    babushkyn, Sep 3, 2011 IP
  3. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    yes i think so but
    so if i have that will post post that variable into the indextest.php
    <script type="text/javascript">
    var video= <?php echo $urlfid; ?>;
    $.post('indextest.php', {urlfid:video});
    </script>
    so the overall code would be
    film.php
    <?php
    include("../../includes/config.php");
    mysql_connect($db_address, $db_username, $db_password);mysql_select_db($db_name) or die(mysql_error());
    $fid = $_GET['fid'];	
    $fid = mysql_real_escape_string($fid);
    $query10 = "SELECT * FROM films WHERE (film_id = '$fid')";	
    $qry_result10 = mysql_query($query10) or die(mysql_error());
    while($row10 = mysql_fetch_array($qry_result10))	
    {	$urlfid="http://www.onfilm.biz/streaming/home/".$row10['film_client']."/".$row10['film_client_office']."/".$row10['film_filename'].".mp4";?>		
    <a class="hofwhite14" href="#" onclick="loadNplay('<?php echo $urlfid; ?>')"><u></u>Property Film</u></a>
    <?php	}mysql_close();
     //EDIT 290510
    ?>
    
    
    <script type="text/javascript">
    
    var video= <?php echo $urlfid; ?>;
    $.post('indextest.php', {urlfid:video});
    
    </script>
    PHP:
    and indextest.php
    <?php $urlfid = $_GET['urlfid']; 
    
    echo $urlfid; ?>
    PHP:
    is that right if so is not working
     
    macaela, Sep 3, 2011 IP
  4. babushkyn

    babushkyn Member

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    2
    Trophy Points:
    26
    #4
    In indextest.php you get urlfid variable in $_POST table, so:
    <?php $urlfid = $_POST['urlfid']; 
    
    echo $urlfid; ?>
    
    PHP:
     
    babushkyn, Sep 3, 2011 IP
  5. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #5
    so wher ethis POST line meant to be on the indextest.php or on the film.php film page is where the database query is and the indextest.php is where i am trying to display the query?
     
    macaela, Sep 3, 2011 IP
  6. babushkyn

    babushkyn Member

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    2
    Trophy Points:
    26
    #6
    You're sending a POST data to indextest.php so you need to put it there if you want to do so.
     
    babushkyn, Sep 3, 2011 IP
  7. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #7
    yeah but the data is coming from fillm.php are you sure you dont mean to put this script
    <script type="text/javascript">
    var video= <?php echo $urlfid; ?>;
    $.post('../bellway/indextest.php', {urlfid:video});
    </script>
    PHP:
    on the film.php where the data is
    and how does the indextest.php grabs or echo the data that came from the film.php
    and do i need a from with that cz i am trying to do without using from?
     
    macaela, Sep 3, 2011 IP
  8. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #8
    From i meant FORM
     
    macaela, Sep 3, 2011 IP
  9. babushkyn

    babushkyn Member

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    2
    Trophy Points:
    26
    #9
    indextest.php has that variable in $_POST table beacuse it's sent by AJAX function from film.php in line:
    $.post('indextest.php', {urlfid:video});
    HTML:
     
    babushkyn, Sep 3, 2011 IP
  10. macaela

    macaela Active Member

    Messages:
    181
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #10
    Hi thanks for the help but maybe is me trying the hard way perhaps you can help me the reason i am trying to do this is to try achieve something i have posted on another thread can you help me out please this the thread
    http://forums.digitalpoint.com/showthread.php?t=2272591
     
    macaela, Sep 3, 2011 IP