HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 7th, 2009, 02:41 AM
aintcricket aintcricket is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 26 aintcricket User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 16 m 19 sec
Reputation Power: 0
Input action='delete.php' type='submit' does not run php file

I am using a while function to create HTML records that reflect an SQL database. Each row of data is a form with it's own change and delete submit buttons. Then I ask the button to run the relative change.php or delete.php nothing happens. Both php's should display 'Hello World' when clicked.

Many Thanks
aintcricket

while($row = mysql_fetch_array($result))
{
echo "<tr><form>";
echo "<td>" . $row['firstname'] . "</td>";
echo "<td>" . $row['lastname'] . "</td>";
echo "<td>" . $row['street'] . "</td>";
echo "<td>" . $row['city'] . "</td>";
echo "<td>" . $row['county'] . "</td>";
echo "<td>" . $row['postcode'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['phone'] . "</td>";
echo "<td>" . $row['fax'] . "</td>";
echo "<td><input action='change.php' type='submit' value='Change'></td>";
echo "<td><input action='delete.php' type='submit' value='Delete'></td>";
echo "</form></tr>";
}

mysql_close($con);

Reply With Quote
  #2  
Old September 7th, 2009, 04:26 AM
coothead's Avatar
coothead coothead is offline
~ bald headed old fart ~
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: chertsey, a small town s.w. of london, england
Posts: 192 coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 17 h 41 m 25 sec
Reputation Power: 86
Hi there aintcricket,

action is an attribute of the form element not the input element.

Also note that the form element may not be positioned between the tr element and the td element.

coothead
Comments on this post
Kravvitz agrees!
__________________

Reply With Quote
  #3  
Old September 7th, 2009, 04:33 AM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,835 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 1 Day 22 h 40 sec
Reputation Power: 4192
To add to what coothead said... In HTML 4 the action attribute must be specified on the form, not the submit button. (In the working draft of HTML 5, there's a new feature to allow the form's action to be specified via an attribute on submit buttons.)

To have different actions, you must detect which submit button was used. So give each submit button a name so that the name/value pairs can be checked via a PHP script when the form is submitted.
__________________
Spreading knowledge, one newbie at a time. I'm available for hire at Dynamic Site Solutions.

Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

Remember people spend most of their time on other people's sites (so don't violate web design conventions).

Reply With Quote
  #4  
Old September 7th, 2009, 06:23 AM
b3n's Avatar
b3n b3n is offline
Prisoner of the Sun
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jul 2004
Location: The Mews At Windsor Heights
Posts: 5,309 b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level)b3n User rank is General 21st Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 4 Days 8 h 2 m 23 sec
Reputation Power: 2349
Facebook Orkut
I don't think it's valid for a form to have a <tr> as its parent.

There's no reason why you can't have a separate form for each button. You might want to set margins, paddings and borders to 0 for the forms and fieldset tags.
PHP Code:
 $delete_btn '<form action="delete.php" method="get">'.
              
'<fieldset>'.
              
'<input type="submit" value="Delete" />'.
              
'</fieldset>'.
              
'</form>';
              
$change_btn '<form action="change.php" method="get">'.
              
'<fieldset>'.
              
'<input type="submit" value="Change" />'.
              
'</fieldset>'.
              
'</form>';

echo 
'<tr>'
       '<td></td>'
.
       
'<td>'.$change_btn.'</td>'.
       
'<td>'.$delete_btn.'</td>'.
       
'</tr>'
__________________
.
:: My blip.fm tunes :: Web Design Feeds :: Web Dev Feeds :: CheatSheets :: PHP :: MySQL :: 13 Moon FB App.

"All matter is merely energy condensed to a slow vibration. We are all one consciousness experiencing itself - subjectively. There is no such thing as death, life is only a dream. We are the imaginations of ourselves."
- Bill Hicks


"Truth is hidden in the subtle nature of the heart of everything, although it is invisible. One cannot see it from inside and neither from the surface. One can only live and experience it."
- Heart Sutra

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Input action='delete.php' type='submit' does not run php file

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap