Jump to content

Recommended Posts

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.)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.