본문 바로가기

form5

[Python] 삭제하기(form, remove) [생활코딩] 활용 - 삭제 구현 삭제버튼 만들기 index.py #!/usr/local/bin/python3 print("content-type:text/html; charset=UTF-8\n") import cgi,os files = os.listdir('data') liststr = '' for item in files: liststr = liststr + '{name}'.format(name=item) form = cgi.FieldStorage() if 'id' in form: pageId = form["id"].value description = open('data/'+pageId).read() update_link = 'update'.format(pageId=pageId) delete_actio.. 2020. 8. 23.
[Nodejs-mysql] 테이블값 업데이트 하기 [생화코딩] 저자 수정 기능 구현 lib/template.js authorTable:function(authors){ var tag = ''; var i = 0; while(i < authors.length){ tag += ` ${authors[i].name} ${authors[i].profile} update delete `; i++; }; // update에 a태그 붙이고 이동 링크는 author/update?id=author의 id값 tag += ''; return tag; } lib/author.js var db = require('./db'); var template = require('./template.js'); var qs = require('querystring'); var url = r.. 2020. 8. 7.
[Nodejs-mysql] 폼 만들고 모듈 분리하기 [생활코딩] 저자 생성 기능 구현 main.js else if(pathname === '/author/create_process'){ author.create_process(request,response); } lib/author.js var db = require('./db'); var template = require('./template.js'); var qs = require('querystring'); exports.home = function(request, response){ db.query('SELECT*FROM topic', function(error, topics){ db.query('SELECT*FROM author', function(error2, authors){ var title.. 2020. 8. 7.
[Nodejs] 글수정하기 - Form [생활코딩] App - 글수정 - 수정할 정보 전송 Form에 기존값 출력하기 // action : submit했을 때 이동할 주소 // 기존 등록되었던 title값 value에 넣어 출력 ${description} // 기존에 등록되었던 description값 출력 Submit 했을 때 수정할 파일 정보도 전달하기 // submit 클릭시 id로 title값을 전달 // 보여질 필요가 없기에 type은 hidden으로 숨김처리 ${description} 2020. 8. 4.
[Nodejs] Form - GET/POST [생활코딩] HTML - Form Form - 사용자가 입력한 정보를 어디론가 보낼 수 있음 내용 입력 후 submit 클릭 - 사용자가 입력한 정보를 action(http://abc.com)이 가리키는 서버로 querystring 형태로 데이터를 전송(GET방식) GET http://abc.com/done?title=hello&description=goodmorning - 서버에서 정보를 가져올 때 ?로 시작하는 querystring 사용 - ?name=data&name=data - 주소에 값이 들어있다면 누군가 그 주소로 들어와 정보를 수정하거나 삭제할 가능성이 있음 - 서버에 데이터를 생성하거나 수정할 때 GET 방식을 사용하면 안됨 POST - 사용자 입력값을 querystring으로 전송하지 않.. 2020. 8. 4.
반응형