tommccann Posted November 9, 2009 Posted November 9, 2009 anyone know how to use dreamweaver to use a text area and use a submit button, to Initially: Save the text area to a text file, using the date and time as the file name. Then Secondly: Grabbing the username and computer name. This is staying offline so nothing that needs publishing to the internet. Cheers guys!! Ps i know how to create a form and add the text areas and submit button, o and its been started in HTML so anyother coding will need to be complient
soveryapt Posted November 9, 2009 Posted November 9, 2009 Using a bit of PHP you should be able to grab the computer name using something like: $computername = gethostbyaddr($_SERVER['REMOTE_ADDR']); and then echoing the variable into a hidden field in your form. That assumes you have a working DNS Server on site obviously. I've not tested it, but if I get chance I will do. Not sure how you might go about the username though.
tommccann Posted November 9, 2009 Author Posted November 9, 2009 Well username isnt very important, its just so i know whos using the webform cheers
tommccann Posted November 9, 2009 Author Posted November 9, 2009 o and also how do you add php into a html site on dreamweaver??
DrPerceptron Posted November 9, 2009 Posted November 9, 2009 http://www.edugeek.net/forums/web-development/43184-grab-username-intranet.html That's only an IIS based solution, I have no idea if you can use Linux to do the same thing... I rolled back over to IIS simply because I couldn't figure out how to do it using Apache.
soveryapt Posted November 9, 2009 Posted November 9, 2009 And then for the next bit (sheesh .. I would save some time if I read and replied to the whole post where I could! lol) //define the path to your file $myFile = ./path/to/filename.txt; //now to open your file (or say you can't) and save it as a variable $filestorage = fopen($myFile, 'w') or die("can't open file"); //now to write your old file back and the new data from the form (repeat the ", $_REQUEST['fieldnames']" for each field you have. The "\n" puts a line break in. fwrite($filestorage, $_REQUEST['fieldnames']."\n"); //and to close your file fclose($filestorage); In terms of putting PHP into Dreamweaver, any php should be contained within the tags: <?php ?> You would have to set your form action to being pointing to a PHP file that has in the parsing things (there are plenty of useful things on Google for setting up form scripts and the like). Of course, the other thing to make sure is that you have PHP installed on your webserver (so if using IIS then you can install PHP onto it either using the nice new tools from Microsoft or by googling for how to do it.
tommccann Posted November 10, 2009 Author Posted November 10, 2009 yea php server is not installed on the server and cant be sadly, this is why i wondering if php was possible. its meant for a local machine and saves to the hard drive, maybe javascript?? thanks for the replies and effort!!
soveryapt Posted November 10, 2009 Posted November 10, 2009 No worries, there's always WAMP if you have local admin rights and it's just for one machine. That will install a local webserver you could use (even share to other machines if you really wanted). Java, well, I google for scripts and credit. Never did really get my head round that one! lol ..
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now