Jump to content

help with php screens


rsammy

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.
Link to comment
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]
Link to comment
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]
Link to comment
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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.