Jump to content


Photo

Submitting to same page


  • Please log in to reply
3 replies to this topic

#1 master82

master82
  • Members
  • PipPipPip
  • Advanced Member
  • 182 posts

Posted 19 June 2006 - 09:38 PM

I have a form on my page, I've made it so when the submit button is clicked it loads up itself (page with the form you just filled in).

I need to change my PHP code at the top of this page to act on the POST data if the submit has been pressed only so...

Is it possible to do something like:

if(formname = submit) {
process data
} else {
whatever...


Thanks in advance [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

#2 Ferenc

Ferenc
  • Members
  • PipPipPip
  • Advanced Member
  • 94 posts

Posted 19 June 2006 - 09:50 PM

<?php

if(isset($_POST['Submit'])){ // name of the submit button
  //process form

}else{

  // display the form

}
?>

Everything you want to know is here.

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 19 June 2006 - 09:50 PM

<?php
if (isset($_POST['submit'])) {
// process this
} else {
// whatever
}

... assuming your form uses the POST method and that your submit input is named 'submit'
Legend has it that reading the manual never killed anyone.
My site

#4 master82

master82
  • Members
  • PipPipPip
  • Advanced Member
  • 182 posts

Posted 20 June 2006 - 09:04 AM

Thanks - will try it now [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users