Jump to content

Archived

This topic is now archived and is closed to further replies.

rsammy

help with php screens

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Here's a sample snippet

[code]<?php
if (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]

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
[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!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.