Jump to content

jasonlive

Members
  • Posts

    10
  • Joined

  • Last visited

jasonlive's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thankyou! its alive . nothing beats that feeling of when code starts working!
  2. i have a php page that is opened by a form. when opened it displays 100's of rows of data from a database. what i need to do is have the user click on some rows, using either a link or a checkbox or something and then submit to the database that "that row" is now "checked" or "flagged" or something. i added a column to the database "flag" with value 0 or 1. also it is preferable to remain on same page after the database update. what would be the best way to do this? -i have tried putting a checkbox in each row, but then i dont know how to build the query at the end to submit multiple rows (how to access each row's name/value) -i then considered making each row a form itself...but seems bulky. (as i write this and wait for advice, im going to try this method it actually seems the easiest) -i considered making each row a link....but then how do i submit a query from a link(using javascript?!)
  3. i tried the header() idea but my browser outputs an infinite loop i will attempt a better select statement
  4. hey all, i am a bit lost on this one. i have a single php page it has a login form a submit new timesheet form and a display my timesheets table. this is updated as soon as the user submits a new timesheet. my issue is, after a timesheet has been submitted once, the table will add a row from the database and its great. but if i page refresh, it submits another identical timesheet. this happens even if i unset all the post variables. what is the best resolution. is there some kind of cookie i have to use? i'd rather avoid cookies. i'd also rather avoid having a second php file. i dont fully understand the $_POST variable concept. why are they not unset?
  5. awesome. ok, so im going to guess how to submit this to the database - my php will be: $string1 = $_POST[string1]; $string2 = $_POST[string2]; $string3 = $string1 . ' ' . $string2; $sql="INSERT INTO MyTable (date, notes) VALUES ('$_POST[date]','$string3')";
  6. i just want to learn how to code. if they were strings, what would be the syntax? is this correct? $string1 = "happy"; $string2 = "birthday"; '$_POST[string1]' . " " . '$_POST[string2]'
  7. thanks (working)! another question - after my coffee i realised - i want to know how to do it both ways. so how would i code this with concatenation?
  8. sorry i need to explain, can you write what i should paste into the code directly? i know its a = b + c. but i dont know how to code that. is it: '$_POST[totalhours]' + '$_POST[totalminutes]' or do i join them as strings - i will need to get the decimal point in there for the query? '$_POST[totalhours]' . "." . '$_POST[totalminutes]'
  9. sorry im very new to this language. what is the syntax to add them? do i put it on the PHP page or the HTML page?
  10. hi, ive just started learning php and sql yesterday. im building a timesheets webpage for employees i want to know how to join the 'totalhours' to "totalminutes' and then put it in the query as one value? eg the databse will store 5.25 or 3.75 etc. the employees will type an hour (eg 5 or 3 ) and then click a radio button that says 15mins or 45mins here is the code so far: PHP $sql="INSERT INTO Persons (notes, starttime, date, finishtime, totalhours, company, breaktime) VALUES ('$_POST[notes]','$_POST[starttime]','$_POST[date]','$_POST[finishtime]','$_POST[totalhours]', '$_POST[comp]','$_POST[breaktime]')"; HTML <form action="submittimesheet.php" method="post"> company<input type="text" name="comp"><br> date<input type="date" name="date"><br> start time <input type="time" name="starttime"> finish time <input type="time" name="finishtime"><br> total break time<input type="text" name="breaktime"><br> total hours worked<input type="text" name="totalhours">(number from 1-10)<br> total minutes worked: <br> <input type="radio" value="0" name="totalminutes">0<br> <input type="radio" value="25" name="totalminutes">15<br> <input type="radio" value="50" name="totalminutes">30<br> <input type="radio" value="75" name="totalminutes">45<br> notes<input type="text" name="notes" style="height: 50px;"><br> <input type="submit">
×
×
  • 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.