Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

import React, { useState } from 'react';

const StaffForm = () => {


const [formData, setFormData] = useState({
name: '',
subjects: '',
timings: '',
});

const handleChange = (e) => {


setFormData({
...formData,
[e.target.name]: e.target.value,
});
};

const handleSubmit = (e) => {


e.preventDefault();
// Add logic to submit staff form data
console.log('Staff Form Data:', formData);
// You can send the data to your backend/API here
window.location.reload();
};

return (
<div>
<h2>Staff Information Form</h2>
<form onSubmit={handleSubmit}>
<label>
Staff Name:
<input
type="text"
name="name"
value={formData.name}
onChange={handleChange}
placeholder="Enter staff name"
/>
</label>
<label>
Subjects (comma-separated):
<input
type="text"
name="subjects"
value={formData.subjects}
onChange={handleChange}
placeholder="Enter subjects"
/>
</label>
<label>
Timings (e.g., Monday 9 AM - 12 PM):
<input
type="text"
name="timings"
value={formData.timings}
onChange={handleChange}
placeholder="Enter timings"
/>
</label>
<button type="submit">Submit Staff Form</button>
</form>
</div>
);
};

export default StaffForm;

You might also like