Results 1 to 3 of 3

Thread: Question about HTML and PHP.

  1. #1
    Senior Member
    Join Date
    Sep 2008
    Posts
    85
    Credits
    296
    Mentioned
    0 Post(s)

    Default Question about HTML and PHP.

    Let's say I have two files, main.html and graph.php.

    Graph.php, displays an image, and I have that image in an <iframe> inside main.html.

    In main.html, I have added some forms, to pass arguments on to graph.php. Works great.

    Only problem, is when I pass those arguments via the form in the html code, and have it linked to graph.php, and I send data to it, it takes me away from main.html and my browser goes directly to the php file - instead of rendering my new data in the iframe.

    Any idea around that?

  2. #2
    McTroy MrTroy's Avatar
    Join Date
    Sep 2008
    Location
    THE BEEF
    Posts
    3,013
    Credits
    1,210
    Trophies
    Mentioned
    0 Post(s)

    Default

    I don't know PHP, but I have a small bit of knowledge of HTML, but whenever you are working with frames you need to tell whatever it is you are working with to target that frame.

    So in basic HTML, if I had a frame of say, 20% 80% for a navigation page on the left and for my pages to show up on the right, on my HTML page that loads in the left frame I would need to put something like <a href="http://url.com/page.html" target=_main">LINK</A>

    Where _main is the name of said frame. I don't know if that helps, basically you need to find a way to tell your page to load new data into the desired frame.
    Quote Originally Posted by DickStivers View Post
    I hope I haven't missed my chance to join MrTroy 4 Life
    Quote Originally Posted by Mr. E View Post
    I blame Obama. That nigger.
    Quote Originally Posted by benzss View Post
    when mrtroy makes a valid point about your posting, you should probably kill yourself
    Quote Originally Posted by djwolford View Post
    This site was always meant to end with a gay gangbang. It's destiny.
    Quote Originally Posted by ozzy View Post
    I don't consider myself a racist, but I fucking hate niggers.
    Quote Originally Posted by MrTroy View Post
    Gwahir and I have this little ongoing tiff. He seems to have that with a number of people who think he is a pretentious faggot.
    Quote Originally Posted by hydro View Post
    I'd rather fuck a child

  3. #3
    team mischief Who's Avatar
    Join Date
    Sep 2008
    Posts
    113
    Credits
    541
    Mentioned
    0 Post(s)

    Default

    Not sure if I understand this correctly, but you have a form on main.html, and whenever you press the submit button it takes you to graph.php, but you just want it to reload the iframe with the new graph.php?

    Two (more or less) easy solutions:

    a) Two forms. One on main.html, one on graph.php. The one on graph.php is entirely hidden, with the same hidden input fields as the ones specified on main.html. You replace the 'submit' button on main.html with a button that runs a script that will copy all the current form values from main.html to the hidden fields in graph.php, then submit the form inside the iframe. Only the iframe should reload then.

    b) This is assuming graph.php is just an image, nothing more. Drop the iframe completely (iframes are stupid), and instead make graph.php directly output the raw image data. Instead of an iframe, you include graph.php within an <img> tag, where the src is "graph.php?param1=foo&param2=bar". Those paramaters are then taken from the form that is submitted directly on main.html. (Of course main.html would have to become a php script for this, so it can dynamically process the image path)



    Edit:

    c) No clue if this exists or not, but there may be a "target" parameter for the <form> tag. If you can target other frames with this form, then the solution is of course ridiculously simple.

Similar Threads

  1. Odd Question
    By Pepsi in forum Technology Today
    Replies: 2
    Last Post: 12-21-2008, 11:11 PM

Tags for this Thread

Bookmarks

Posting Permissions

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