GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 13-Jul-2004, 17:48
da_bomb50 da_bomb50 is offline
New Member
 
Join Date: Jul 2004
Posts: 21
da_bomb50 is on a distinguished road
Question

PHP on button click??


Is it possoble to have a php script executed when pressing a form button
(eg. <input type="button" value="Send" onClick=this is where i want the php where JScript would normally go>) Or does the server only execute php on page load?
  #2  
Old 14-Jul-2004, 07:30
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
You can use a variation of this:
<input class='buttons' id='page' onclick="another_page.php" type='button' value='Another Page' name='another page' />
  #3  
Old 01-Aug-2004, 09:36
hellcat1 hellcat1 is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Location: Spring, TX
Posts: 7
hellcat1 is on a distinguished road
Question

Quote:
Originally Posted by misunderstood
You can use a variation of this:
<input class='buttons' id='page' onclick="another_page.php" type='button' value='Another Page' name='another page' />

So how exactly do you get this to work? When I try putting
Code:
<input class='buttons' id='page' onclick="./modules.php?name=automaint&page=editdata" type='button' value='Edit Your Data' name='another page'>

The button shows up, but does not take you to "./modules.php?name=automaint&page=editdata"
  #4  
Old 02-Aug-2004, 06:13
jlee jlee is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Posts: 9
jlee is on a distinguished road
Quote:
Originally Posted by da_bomb50
Is it possoble to have a php script executed when pressing a form button
(eg. <input type="button" value="Send" onClick=this is where i want the php where JScript would normally go>) Or does the server only execute php on page load?

Can you not get the php script to run by putting the reference to the page in the action part of the form tag? Like:
<form name=myform, method=post, action=phpscript.php>

Then you just use the submit button without the onClick part - when it is clicked the php script on phpscrip.php page will run.

I think this would work?
  #5  
Old 03-Aug-2004, 02:09
conkermaniac conkermaniac is offline
Member
 
Join Date: Dec 2001
Location: China
Posts: 174
conkermaniac is on a distinguished road
The button would have to link to a new page in order for the PHP to take effect. PHP is a server-side scripting language, meaning that all PHP code is processed during page load (and subsequently converted to client-side code--usually HTML, but also some DHTML). Only if you load up a new page can the server process new PHP code.

Please correct me if I misunderstood your original request.

Conker
__________________
You're not supposed to be looking at this.
  #6  
Old 04-Aug-2004, 11:21
da_bomb50 da_bomb50 is offline
New Member
 
Join Date: Jul 2004
Posts: 21
da_bomb50 is on a distinguished road
Nope, you were bang on. I figured out how to do it anyways with a submit button and querystrings instead.
  #7  
Old 10-Aug-2004, 00:50
JasonMichael's Avatar
JasonMichael JasonMichael is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Posts: 135
JasonMichael has a spectacular aura about
Use a javascript redirect to run the PHP code you want, for your 'onclick' event.

HTML Code:
<input class='buttons' id='page' onclick="location.relocate('./modules.php? name=automaint&page=editdata')" type='button' value='Edit Your Data' name='another page'>
  #8  
Old 10-Aug-2004, 01:32
da_bomb50 da_bomb50 is offline
New Member
 
Join Date: Jul 2004
Posts: 21
da_bomb50 is on a distinguished road
Oooo, pretty nifty. Thanks.
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
uisng php to display php dopee MySQL / PHP Forum 6 14-May-2004 19:40
php software dopee MySQL / PHP Forum 0 04-May-2004 12:26
Automate a data change php form mjfmn MySQL / PHP Forum 4 20-Oct-2003 10:37
All the big PHP script collections that matter jrobbio MySQL / PHP Forum 5 06-Jun-2003 17:14
Sydog's DVD to Divx Conversion Guide asanthadenz Computer Software Forum - Windows 1 14-Mar-2003 15:08

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:57.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.