rsammy Posted August 14, 2006 Share Posted August 14, 2006 guyz,i have a screen with some fields like first name, middle initial, last name, address, city, state, zip, phone number, date of birth, ssn. user populates these fields with some values. i need to store these values in the database. (insert into a table, say patient table in MySQL database) when user clicks on Add button on screen. On clicking Add, a new screen appears displaying all the above fields as Text only fields(cannot be edited) with a text saying the following patient has been added!while entering the values in the fields, if user enters the name as john smith, it should be displayed on the screen as John Smith and entered into the db as such. i know there is a function called onBlur and i have a fucntion written for it too. but, it doesnt work! ???I know its a simple app. but, i am kinda new to php and am still findin it difficult to go about this one. i need help big time. any help here would appreciated greatly. thanks in advance. Link to comment https://forums.phpfreaks.com/topic/17566-help-with-php-screens/ Share on other sites More sharing options...
Barand Posted August 14, 2006 Share Posted August 14, 2006 Here's a sample snippet[code]<?phpif (isset($_GET['submit'])) { $name = ucwords($_GET['name']); echo "Name : $name"; mysql_query("INSERT INTO patients (name) VALUES ('$name')") or die(mysql_error());}?><FORM><input type="text" name="name" size="30"><input type="submit" name="submit" value="Submit"></FORM> [/code] Link to comment https://forums.phpfreaks.com/topic/17566-help-with-php-screens/#findComment-74806 Share on other sites More sharing options...
rsammy Posted August 15, 2006 Author Share Posted August 15, 2006 thanks. but, itd be great if u can be a lil more specific. im a novice in php! i really appreciate ur quick response tho! Link to comment https://forums.phpfreaks.com/topic/17566-help-with-php-screens/#findComment-75287 Share on other sites More sharing options...
Barand Posted August 15, 2006 Share Posted August 15, 2006 A simple form with a name input field and a submit button. The default form method is GET and the default action it to call the sames page[code]<FORM><input type="text" name="name" size="30"><input type="submit" name="submit" value="Submit"></FORM>[/code]Processing[code]<?php//// check if data has been sent to the page//if (isset($_GET['submit'])) { // // make first letter of each word upper case (http://www.php.net/ucwords) // $name = ucwords($_GET['name']); // // echo the name eg John Smith // echo "Name : $name"; // // update the database inserting a new record with eg name = John Smith // mysql_query("INSERT INTO patients (name) VALUES ('$name')") or die(mysql_error());}?> [/code] Link to comment https://forums.phpfreaks.com/topic/17566-help-with-php-screens/#findComment-75292 Share on other sites More sharing options...
rsammy Posted August 17, 2006 Author Share Posted August 17, 2006 [quote author=Barand link=topic=104273.msg416376#msg416376 date=1155670763]A simple form with a name input field and a submit button. The default form method is GET and the default action it to call the sames page[code]<FORM><input type="text" name="name" size="30"><input type="submit" name="submit" value="Submit"></FORM>[/code]Processing[code]<?php//// check if data has been sent to the page//if (isset($_GET['submit'])) { // // make first letter of each word upper case (http://www.php.net/ucwords) // $name = ucwords($_GET['name']); // // echo the name eg John Smith // echo "Name : $name"; // // update the database inserting a new record with eg name = John Smith // mysql_query("INSERT INTO patients (name) VALUES ('$name')") or die(mysql_error());}?> [/code][/quote]great! got it. thanx for ur help! Link to comment https://forums.phpfreaks.com/topic/17566-help-with-php-screens/#findComment-76456 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.