Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

php embedded into html, problems

Options
  • 11-06-2007 6:52pm
    #1
    Registered Users Posts: 490 ✭✭


    First off,
    Many thanks to louie for helping me out last time with the IE css problems.

    What im trying to do now is have an integrated php uploader for the website.
    It works fine on its own as a .php file, but its very bare.
    So in keeping with the rest of the site im trying to embed it into my a html page and control its position through css.

    Its not working but I think that this is the problem
    <form action="<?=$_SERVER?>"

    I took all the code from the .php file and put it into the html file, but I think that its looking for the rest of the php code in the php file, which is now part of the html? Does that make any sense?
    I was thinking that the solution would be to create another .php file and have the "php_self" changed to that location?

    The webpage is
    http://andy.ie/uploadertesting/uploader.html

    Cheers in advance for the help!, and for having a look too.


Comments

  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    You can't put PHP in an HTML file.

    You can, however, put HTML in a PHP file. It'll work just the same.

    Rename the file uploader.php and try that.


  • Registered Users Posts: 94 ✭✭Kudos


    PHP code goes in .php files so the webserver knows to parse them. Just rename the extension to .php


  • Registered Users Posts: 490 ✭✭spidermonkey


    ye guys rock!

    thanks a million! :D


  • Registered Users Posts: 490 ✭✭spidermonkey


    its working very nicely, and thanks a million for ye're help,
    but...
    the plan is for the uploader to work in tandem with the flash gallery we have at the moment, the uploader puts the content onto the server into an 'uploads' folder and the flash gallery we have reads the image location data from an xml file,
    is it possible to have the php uploader edit the xml file during the upload to add the image link information to it too?
    thanks again,
    ye must be well annoyed with me by now...


  • Registered Users Posts: 7,739 ✭✭✭mneylon


    Actually you can put php into html IF Apache knows to parse the html files as php. Depending on your server setup it can be as simple as adding a couple of lines to a .htaccess


  • Advertisement
  • Registered Users Posts: 3,401 ✭✭✭randombar


    php can edit an xml file pretty easy from what I can remember, just load in the xml file with
    $myFile = "blahblah.xml
    $content = file_get_contents($myFile);
    

    Use a php function like ltrim to take off the end of the xml file from $content then add what you want to it.

    then just write to a file or something


Advertisement