Skip to content
Snippets Groups Projects
Commit 521fb1a5 authored by Ashwanth K's avatar Ashwanth K
Browse files

Upload New File

parent 3f9681c0
No related branches found
No related tags found
No related merge requests found
import React, { Component } from 'react'
import './forms.css'
import axios from 'axios';
export default class Uupdate extends Component{
constructor(props){
super(props);
this.state = {
User_id: '',
name: '',
Email: '',
Password: '',
}
this.handleChange=this.handleChange.bind(this);
this.update=this.update.bind(this);
}
handleChange (event) {
this.setState({ [event.target.name]: event.target.value});
}
update(event){
const user = {
user_id: this.state.User_id,
name: this.state.name,
email: this.state.Email,
password: this.state.Password,
}
axios.post('http://localhost:5000/user/update/'+this.state.User_id,user)
.then(window.alert("User Updated successfully!"))
.catch(console.error())
event.preventDefault();
}
render(){
return(
<div>
<h3 style={{fontFamily:"Roboto",marginLeft:"20px"}}>
<b>USER UPDATION</b>
</h3>
<form>
<ul style={{listStyle:"none"}}>
<li><div>
<input type="text" placeholder="User_id" name="User_id" onChange={this.handleChange} required/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" placeholder="User_Name" name="name" onChange={this.handleChange} required/>
</div></li>
<li><div>
<input type="text" placeholder="Email" name="Email" onChange={this.handleChange} required/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" placeholder="Password" name="Password" onChange={this.handleChange} required/>
</div></li>
<li><div>
<input type="submit" value="Update" onClick={this.update}/></div></li>
</ul>
</form>
</div>
);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment