Jump to content

post to self


harkly

Recommended Posts

Trying to get my form to submit to itself. However I am also trying to use an image for my submit button, when I set the type='image' it will not submit to itself. Can someone help me figure out why?

 

my button code:

<input type='submit' name='submit' value='submit' src='img/button_add.gif' width='64' height='25' class='outline' onmouseover=\"javascript:this.src='img/button_add2.gif';\" onmouseout=\"javascript:this.src='img/button_add.gif';\">

 

my if:

 

if( isset($_POST['submit']))

 

 

form:

        <form  method='post' action="<?php echo $_SERVER["PHP_SELF"]; ?>" name='mailcheck' id='form_id'>

 

 

Everything works well if I don't post to self so I can always do that.

Link to comment
https://forums.phpfreaks.com/topic/192580-post-to-self/
Share on other sites

when you use type='submit'    it posts the x,y coordinates of the images.    The name plus x or y. Try a print_r($_POST) at the top of the page  with type='submit'      and you'll see what I'm talking about. 

 

 

You should check for one of those instead.  Or use a hidden field and check for it.   

 

<input type='hidden' name='submitmyform' value='true'>

for the x, y

if(isset($_POST['submitmyform_x']));    // or submitmyform_y
{
    // do whatever here 
}

for the hidden field

if($_POST['submitmyform']) { 
// do whatever here 
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/192580-post-to-self/#findComment-1014880
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.