cutiepatootie272 Posted October 14, 2008 Share Posted October 14, 2008 Hi, I'm new at PHP development (and programming in general) but have had to learn it for a college project. So hopefully this code doesn't look too dumb. A Java program is sending me variables through the post method. Here is my code: <html> <?php $ClockNum = $_POST['clock_registration']; settype($ClockNum, "string"); $Time = $_POST['time']; $ampm1 = $_POST['ampm1']; $Alarm = $_POST['alarm']; $ampm2 = $_POST['ampm2']; $fh = fopen($ClockNum, 'w'); fwrite($fh, $ClockNum); fwrite($fh, $Time); fwrite($fh, $ampm1); fwrite($fh, $Alarm); fwrite($fh, $ampm2); fclose($fh); ?> </html> I thought I needed to convert the variable to a string, but even this doesn't help. It wasn't working before of after I tried inserting that line. The permissions settings are all fine, including the files to which the program writes. Any ideas??? I need help...fast. Also, I know my code is very sloppy. What is the proper way to combine all of the fwrite lines? And do I need the html tags at all? (I also tried with those removed, just in case.) Quote Link to comment https://forums.phpfreaks.com/topic/128382-writing-to-a-file-with-posted-variable-name-help/ Share on other sites More sharing options...
MadTechie Posted October 14, 2008 Share Posted October 14, 2008 Okay.. whats not working. ? Quote Link to comment https://forums.phpfreaks.com/topic/128382-writing-to-a-file-with-posted-variable-name-help/#findComment-665127 Share on other sites More sharing options...
Maq Posted October 14, 2008 Share Posted October 14, 2008 Are there any errors? Do you have error display turned on? First you need to debug, please echo all your variables out to make sure they contain the correct values. Quote Link to comment https://forums.phpfreaks.com/topic/128382-writing-to-a-file-with-posted-variable-name-help/#findComment-665138 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.