Jump to content

DarkElf

Members
  • Posts

    103
  • Joined

  • Last visited

Everything posted by DarkElf

  1. Nice idea, I'll give it a go, ta.
  2. I would use php for this, infact It sound's a little like you want to do something fairly similar to something I've done myself with php. Could you post this question in the php forum and give a little more details about what exactly you are trying to acheive?
  3. A strange question but..... is it possible to carry post variables forwards through several pages?I've got a site where the user assigns a variable using a form on the first page, the variable is then used in the second page to access a relevent file which the user then modifies using a textbox, they then submit this to a third page which write's their modifications to the file (which obviously needs the original variable to identify the file).At the minute there is a form field on the second page in which the user can re-enter the first variable, the default value of this is the first variable and so as long as the user doesn't change this field all is fine, however I don't want them to be able to change this at all.Is there a way of carrying the variable forwards automatically, or getting the php/html to post the old variable again when the user submits the form on the 2nd page without it being a field the user has defined?
  4. DarkElf

    Form Processing

    Furthering my previous post - a different syntax issue could be that you've not bracketted the variables after the echo statement e.g. echo ($da.$lol). As echo isn't technically a php "function" (for reasons I don't fully understand but am assured are correct) this shouldn't matter though.
  5. DarkElf

    Form Processing

    Does php give you an error message? If so that might be useful.What it might be is that because the user only presses one of the buttons maybe only one of the values will be posted (I could be wrong, it's just a theory). If this is the case then maybe it gets iffy when you try echoing both values and only one exists.Alternatively it might be a syntax issue. There are 3 different ways of accessing post variables. $_POST['daaaa'] is the medium form, there is also long form which is $HTTP_POST_VARS['daaaa'], and short form in which the post variables are automatically assigned their previous name so you could just use $daaaa (php assigns the variable for you without you having to do it). Which forms are allowed is determined by your php administrator and the version of php in use, it should be listed somewhere in the stuff spurted out by the phpinfo() function. Try using the different syntaxes. Note that the long form is being depricated in the next version of php.Another thing it might be having quibles with is that you are sending information to the same page. This shouldn't be a problem, but try and see if it works putting the php on another page and posting to that page?
  6. DarkElf

    Added slashes

    You just add the line: php_flag magic_quotes_gpc off to the htaccess file.It's clean but it does mean that if you are moving the page to another location or server you have to ensure that you remember to update the new htaccess file (assuming magicquotes is a problem at the new location). If you use the stripslashes line its not as clean but makes the code more portable as you needn't have to worry about remembering to do this.
  7. It doesn't just cause a problem with email forms.... it effectively disables the use of all post data
  8. DarkElf

    Added slashes

    ah, I see. I've managed to disable magic quotes by putting a line in the htaccess file, so I can avoid using stripslashes, though I may add the stripslashes line at some point to make the code more portable. Cheers for that.
  9. alternatively if you swapped the date and the $storyid around you could use a regular expression followed by $ symbol to show that it has to match at the end of the string, its pretty much the same thing but uses less code.
  10. DarkElf

    Added slashes

    I'm building a simple content managment system fo my website. The website is basically a template page which defines all the headers, footers and borders for the website and then the specific html content of each page is stored in a txt file which is added to the template using include. The CMS opens these txt files and loads their content into a textarea in which I can modify the code, then it uses fwrite to write the code back to the file when you submit it.It's very very basic and has several holes (for instance if the page you are modifying also contains a textarea the whole thing goes squewiff ) but most of which aren't major problems and I can fix them myself. It's not intended to be super clever anyway, it simply allows me to modify the html of my pages online without having to use an ftp client to upload every little change.The problem I don't understand is that when it writes the file is adds a backslash (\) to every occurence of ". e.g. the original file contains the code <p class="main">, this is also what appears in the text area when it is loaded into it (using fgets and echo statements), however when it writes back to the file using fwrite it writes <p class=\"main\">, which obviously messes up the page! I assume that the php does this to escape the " symbol which would otherwise cause problems in the script, but why does it do it by itself without my instructing it to? and is there a way round my problem?
  11. cunning, why didn't I think of that cheers
  12. This is a bit of a wierd question, and I'll not bore you with a detailed explanation of why I'm asking it.Basically I need to know if there is a way of escaping the html escape sequences if that makes sense. e.g. By xhtml standards you shouldn't use the '<' symbol as part of the printed text of a document as it is an important reserved character used as part of html tags, instead you use the sequence < which the browser interprets and prints as '<'.Is there a way of escaping this so that you can make the browser print < instead of '<'?
  13. DarkElf

    Firefox problem

    genius, ta very much.
  14. Try this website, it'll write all the code you need for you:http://www.tele-pro.co.uk/scripts/contact_form/It's not quite what you are looking for, the form it generates only sends to one predefined address, however I bit of tweaking and modification should get it to do as you wish If you can't manage it yourself then just come back and ask for some more help and I'll see what I can do for you :)One thing I would point out is that such a form in which the user can modify the email headers does leave you open to abuse, a clever hacker can use your form to annonymously send spam from your server won't necessarily effect you personally, but its the kind of thing everyone should be on gaurd against.
  15. Your website is broken the email form doesn't seem to exist at the moment, you might want to fix that!
  16. DarkElf

    cant see css file

    In which case I don't know what is wrong, but I think my suggestion might still work. Reference the css in the header and then give the xml element a relevant class/id so the correct formatting is applied.
  17. DarkElf

    a newbie question

    I don't think you can actually do what you are trying to. If the page content doesn't actually fill the screen there will always be a blank space at the bottom, setting margins won't cause the content to stretch to fit it.Similarly if the content over fills the screen it won't squish it to fit the screen. It will create margin around the bottome of the page, but the page it self is allowed to run off the bottom of the browser window.Hope that makes sense. If you are trying to expand or contract your content to fit the screen you need to do it another way, for example set element dimensions to 100%.Alternatively if you just want the content at the bottom (the footer) to always display at the bottom, leaving a gap between the page content and the footer, you could use position:absolute.
  18. DarkElf

    Fixed Header

    is it the redirect you are having the problem with? Maybe I didn't explain it properly, here's a complete example of the index.html file you need: <html><head><title>Redirect</title><meta http-equiv="Refresh" content="1;url=http://www.yourpage.com/index.php" /></head><body><p>You should now be redirected to my website. If the website does not load click <a href="index.php">here</a>.</p></body></html> That should redirect the user to your php page. If you are still having problems it is probably because your host doesn't have php installed, in which case you are stuck (either get a new host or doen't use php - boen suggested an alternative but more complicated solution earlier).Make sure you have a complete php page as well, such as: <html><head><title>My Page</title></head><body><?phpinclude ('header.htm')?><p>Page content.</p></body></html> The header.htm file does not have to be a complete html file, just the content you wish to include, it is effectively pasted into the index.php html in place of everything between the php tags. If you wrote the header.htm file out in proper html you would be pasting close tags in funny places and that would confuse the browser.A note on boen_robots' use of require - require is dangerous for this kind of use as if the page cannot load the require function it will not load any of the page at all. If there is an error with your header.htm (such as the data got corrupted) then it would stop the whole page (infact the whole website as the header will be on every page) from loading. Using include means that if the header.htm file has a problem the rest of the page will still load.
  19. When the server executes a php page it does what is called 'parsing' the php. It reads everything between the php tags and executes that code. Once the script is executed the php is removed before the html is submitted to the browser, the php tags and everything between them is removed, thus making your page secure.
  20. DarkElf

    PHP Project

    You have to pay for it, but this is a really good book which I've been using http://www.samspublishing.com/title/0672326728
  21. Oops, sorry, forgot to add a solution I suggest that you work around this by exiting from your ajax script for a brief time. Use form action 'formproccess.php' but then include a meta refresh on the formprocess page to bounce the user back to the ajax page loading the confirmation message in the relevant div. It means you need to use 3 pages to handle the whole email form instead of 2, but the user will probably not even see the one in the middle it refreshes so fast anyway.
  22. This quite an interesting problem. I've never tried doing that kind of javascript thing so I might be wrong about this, but I think I might know what is going on.When the user submits a form the contents are submitted to the post array for the page which is loaded by the action attribute, this array is stored by your browser and the server takes information from it, similar to a cookie really. But I think that because of the way you are doing it the post array in your browser doesn't get refreshed, only the contents of the div do. Normally this is a good thing (atleast for what you are trying to do), the rest of the page including the url stays the same - a neat trick which saves unneccasary downloads of repeated information, speeding up your site for users and reducing traffic on your server.Unfortuntately it causes you problems when using form inputs. You submit the form and the inputs are sent to the array for formproccess.php, but the page loaded in your browser is not formprocess.php, it is your index page so the post array in the browser is empty. Therefore the mail script executes and sends an email when it is called, but when it checks the browser for the post array it finds nothing so sends an empty e-mail.
  23. Try learning how to use php's mail() function. You'll also need to use the post() get() or request() functions to get hold of the information the user has input and put it into the email. As aspnetguy says - you need to use a server side script which you will embed on the page the action attribute of the form sends the user to. If you don't know any server side scripting languages you could try using a free script such as this http://www.tele-pro.co.uk/scripts/contact_form/You would need to add a second mail function to the above to send the confirmation email to the user. However this may not be neccesary as the above script leaves the user on a page which confirms that the email has been sent anyway. I'm not sure there is really any point in sending the user an email to confirm the email has been sent even if it didn't do that, as all it could ever do is confirm it had been sent - it can never confirm whether or not it was received which is what I think you really want to do!
  24. A simple solution would be to have a different html page for each set of lyrics. It's a bit long winded but the easiest to understand and implement. Otherwise you are getting into complicated javascript and DOM which would take you a while to learn and to get to grips with.
  25. The tough truth is that if you are trying to get by by using free hosts then you are just going have to live with restrictions/poor service. People are providing you with a service for free and you've just got to lump it when they can't be bothered to make things run perfectly.As soon as you are paying for it it is an entirely different story. There are loads of decent hosts out there that offer good service for relatively cheap prices (you're talking $3-4 a month, not an amount that'll break the bank). I personally use http://www.orbital-hosting.com
×
×
  • Create New...