Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts

    How to make echo work?

    I'm trying to get the variable to echo in the video embed script below. There are no errors or anything on the page but the page is completely blank when I load it. And when I look at the source code data has nothing in it.

    video embed script:
    Code:
    <?php
    $dlink = $_POST["decallink"];
    ?>
    
     <object
        type="video/avi"
        data="<?php echo $dlink; ?>"
        width="100%"
        height="100%"
        <param name="video" value="<?php echo $dlink; ?>">
     </object>
    the form:
    Code:
    <form name="decallink" action="/projects/decal.php" method="post">
    <input type="text" name="decal" value="Decal Link" />
    <input type="submit" value="Submit" />
    </form>
    Last edited by elitis; 11-05-2010 at 11:39 PM.

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,205
    Thanks
    15
    Thanked 253 Times in 253 Posts
    Should be
    $dlink = $_POST["decal"];
    to get the submitted value.

  • #3
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by DrDOS View Post
    Should be
    $dlink = $_POST["decal"];
    to get the submitted value.
    ? tried it and it didn't work. also [""] is the form name, which is decallink, not decal.

  • #4
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    try to output all submitted data
    PHP Code:
     print_r($_REQUEST); 

  • #5
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by poyzn View Post
    try to output all submitted data
    PHP Code:
     print_r($_REQUEST); 
    sigh... getting a 404 error with that

  • #6
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,205
    Thanks
    15
    Thanked 253 Times in 253 Posts
    That's probably the extra slash in front of this

    action="/projects/decal.php"

    but you'll still need to make the change I suggested. I tried it and it worked.

  • #7
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by DrDOS View Post
    That's probably the extra slash in front of this

    action="/projects/decal.php"

    but you'll still need to make the change I suggested. I tried it and it worked.
    could you post exactly what (and where) changes I need to make. Cuz I still can't get that to work.
    Last edited by elitis; 11-05-2010 at 10:11 PM.

  • #8
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,205
    Thanks
    15
    Thanked 253 Times in 253 Posts
    These are the two files, not very much different from yours. PS: check your permissions!
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="content-type">
    <script type="text/javascript">
    //Alerts to errors.
    window.onerror=function(msg, url, linenumber){var logerror='Error message: ' + msg + '. Url: ' + url + 'Line Number: ' + linenumber;alert(logerror);return false}
    </script>
        <title>HTML 4.01 Transitional!</title>
    <style type="text/css">
    <!--
    body
    {
    margin: 0 auto;
    width:900px;
    font-family:serif
    }
    div
    {
    width:198px;height:58px;
    background-color:#f8ffe0;
    border:1px solid #ff0000;
    padding:20px;
    margin-top:10px
    }
    -->
    </style>
    <script type="text/javascript"></script>
    </head>
    <body>
    <form name="myform1" action="index1.php" method="post">
    <input type="text" name="decal" value="Decal Link" />
    <input type="submit" value="Submit" />
    </form>
    <form name="myform1" action="index1.php" method="post">
    <input type="text" name="decal" value="Decal Link" />
    <input type="submit" value="Submit" />
    </form>
    <div></div>
    </body>
    </html>
    **************************************
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="content-type">
    <script type="text/javascript">
    //Alerts to errors.
    window.onerror=function(msg, url, linenumber){var logerror='Error message: ' + msg + '. Url: ' + url + 'Line Number: ' + linenumber;alert(logerror);return false}
    </script>
        <title>HTML 4.01 Transitional!</title>
    <style type="text/css">
    <!--
    body
    {
    margin: 0 auto;
    width:900px;
    font-family:serif
    }
    div
    {
    width:198px;height:58px;
    background-color:#f8ffe0;
    border:1px solid #ff0000;
    padding:20px;
    margin-top:10px
    }
    -->
    </style>
    <script type="text/javascript"></script>
    </head>
    <body>
    <?php
    $dlink 
    $_POST["decal"];
    ?>
     <div>
     <object
        type="video/avi"
        data="<?php echo $dlink?>">
        <param name="video" value="<?php echo $dlink?>">
     </object>
    </div>
    </body>
    </html>
    Last edited by DrDOS; 11-05-2010 at 10:40 PM.

  • #9
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    Quote Originally Posted by elitis View Post
    sigh... getting a 404 error with that
    so you should check your script url '/projects/decal.php'
    if you process data in the same file, try to remove action="/projects/decal.php" from form tag and run script

  • #10
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,537
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Quote Originally Posted by elitis View Post
    ? tried it and it didn't work. also [""] is the form name, which is decallink, not decal.
    Actually, $_POST['whatever'] references a passed variable... a form does not pass a variable, elements in the form do. In this case, 'decal', which is your input. The name of the form is irrelevant and not passed.

    Also, NEVER use REQUEST. REQUEST guesses from two sets of variables... you should know if you're getting a POST or GET, never let the system decide for you.

    Finally, can you post your updated code? We can't really guess what where you're going wrong.

  • #11
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by Keleth View Post
    Actually, $_POST['whatever'] references a passed variable... a form does not pass a variable, elements in the form do. In this case, 'decal', which is your input. The name of the form is irrelevant and not passed.

    Also, NEVER use REQUEST. REQUEST guesses from two sets of variables... you should know if you're getting a POST or GET, never let the system decide for you.

    Finally, can you post your updated code? We can't really guess what where you're going wrong.
    after changing the coding around, I changed it back to the original. So, its the same as my first post right now.

    EDIT: Changed $dlink = $_POST["decallink"] ; back to $dlink = $_POST["decal"] ; again and its giving me a 404 error. I'm guessing the script is thinking the link is on my site, which is why is 404'ing
    Last edited by elitis; 11-05-2010 at 10:59 PM.

  • #12
    Regular Coder
    Join Date
    Oct 2009
    Location
    Florida
    Posts
    155
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Wait,

    so "/projects/decal.php" is not on your site? You would need to put the full address like so: http://sitename.com/projects/decal.php

  • #13
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,537
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Also, changing what variable you pull should not give you a 404... it shouldn't be changing your URL at all...

    Delete your object and echo out $dlink on its own, tell us what happens.

  • #14
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by The reaper View Post
    Wait,

    so "/projects/decal.php" is not on your site? You would need to put the full address like so: http://sitename.com/projects/decal.php
    no, /projects/decal.php IS on my site. I'm talking about the link I'm entering into /projects/dce.php (the form)

  • #15
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    Quote Originally Posted by Keleth View Post
    Also, changing what variable you pull should not give you a 404... it shouldn't be changing your URL at all...

    Delete your object and echo out $dlink on its own, tell us what happens.
    works perfectly. But with the object it gives me a 404.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •