Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tieing in a javascript and php function

Status
Not open for further replies.

rninja

Technical User
Apr 11, 2001
381
US
How do I make a javascript function speak with a php function so to speak?

Here is the idea:
1) I have a link that says "remove" which brings up a simple Javascript function which allows the user to choose yes or no.

2)If yes is clicked it should activate a php function which deletes records from the Database.

How do I integrate the two so to speak?

Rninja

sl_sm.jpg

 
When you realize Javascript runs on client and php runs on server, you'll see the answer. Javascript will have to refresh the page with required data. To do that, you can either make a form or a link:

1. FORM
a) Create a form around your remove button
b) Put Javascript function on submit
c) If 'yes' submit form if 'no', return false
d) On the next page, parse results.

2. LINK
a) Create a link remove button with ?id=idnumber to distinguish the record
b) Put Javascript function on onclick event
c) If 'yes' redirect to new page, if 'no' return false
d) On the next page, parse results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top