I'm putting together a VERY simple time tracking widget to embed into my companies homepage. It's going to be broken down by individual offices and I'm formatting it as a drop-down box with no more than ten employees in it and two buttons (clock-in and clock-out) the problem is that I'm not sure how to make this same field work with both of these buttons. Can anybody give me some guidance on how to format the form so that it can use either of the submit buttons?

Recommended Answers

All 5 Replies

They don't have to be submit inputs, they can be button tags which set a field to say clockin or clockout and then submit the form though you could do exactly the same thing with submit inputs

The problem is that, in my experience in input forms, you have to designate which PHP component it will use in the "form action" field, but I'm using two different PHP actions.

Maybe there's a way to use the clock-in and clock-out buttons as a sort of "toggle" inside the php form rather than completely separate forms.

The problem is that, in my experience in input forms, you have to designate which PHP component it will use in the "form action" field, but I'm using two different PHP actions.

Maybe there's a way to use the clock-in and clock-out buttons as a sort of "toggle" inside the php form rather than completely separate forms.

If by action you mean file, don't do that. Really for something this simple this should only be one file in total (ie., the form posts to the page it exists on)

I think I know what I have to do, I'm just a little stuck on finding the code to do it. I think it needs to be something like this:
Clock-In button (submits, adds timestamp and "IN" tag
Drop down box for field data<
Clock-Out button (submits, adds timestamp and "out" tag

Is this the best solution? and how do I format the buttons to do this.

You don't need the button to add the timestamp, you can do that in PHP. All you need the buttons to do is the in or out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.