Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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