Jump to content

Alex020691

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Alex020691's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I've only been doing php for a couple of days, so apologies if this is wrong, it seems to work when I've been testing it. I KNOW this isn't the most efficient/best way, but its the only way I could do it with my limited knowledge . <html> <body> <b><u>Finishing time finder</u></b><br><br> <form method='post' action='duration2.php' name='starttime'> <table cellpadding=2 cellspacing=2> <tr> <td> Start time [hh:mm]</td><td> <input type='text' name='start' maxlength='5' size='5'></td></tr> <tr><td> Duration [hh:mm] </td><td> <input type='text' name='duration' maxlength='5' size='5'></td></tr> <tr><td> <input type='submit' name='submit' value='Find finishing time'> </td><td> <input type='reset' name='reset' value='Reset fields'></td></tr> </table> </form> <br> <?php $start = $_POST['start']; $duration = $_POST['duration']; $startM = explode(":", $start); $durationM = explode(":", $duration); $array0 = $startM[0]+$durationM[0]; $array1 = $startM[1]+$durationM[1]; if ($array1>=60) { $array1 = $array1-60; $array0 = $array0+1; } while ($array0>=24) $array0 = $array0-24; echo 'Your finishing time is: '; if ($array0>=10) echo $array0; else echo '0'.$array0; echo ':'; if ($array1>=10) echo $array1; else echo '0'.$array1; ?>
  2. Thanks SO much to both of you, I combined what you said with the little knowledge I have and now the page works perfectly, and I can continue with my learning . Thanks again, topic solved.
  3. Hey everyone, I'm VERY new to php, only started learning a couple of days ago. Basically, I'm trying to write a script to convert Co-ordinates in the form 'a! b! c!' into '20+a! 20+b! 20+c!'. I've managed to figure out how to do one line, but am completely stumped upon trying to work out the next line. I've done a basic HTML textarea form being processed to the .php file, with these variables: $origdata = $_POST['origdata']; $origdata = preg_replace('/(\\s){2,}/', '$1', $origdata); Followed by: $pieces = explode(" ", $origdata); echo 20 + $pieces[0].'!'.' '; echo 20 + $pieces[1].'!'.' '; echo 20 + $pieces[2].'!'.' '; Which basically turns, for example, '-719.473! 257.075! 10.105!' into '-699.473! 277.075! 30.105!'. Any help would be appreciated, thanks. Here is a screenshot of my progress, so you should be able to get the general idea, because I'm really bad at explaining things. http://i44.photobucket.com/albums/f3/venomxsigs/inputoutput.png
×
×
  • 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.