Jump to content

Recommended Posts

Hi all

 

I have this buton configuration:

 

<input type="submit" name="submit" id="submit" value="Submit" on click="this.form.submit"/>

 

is working fine...!!

 

When i try to change my submit button to an image like that:

 

input type="image" src="../../play button.bmp" height="25" width=" 130" alt="Submit Form"

 

doesn't work.

 

Can you help?

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/
Share on other sites

The solution given by dannyb785 doesn't work!!!

 

What *exactly* doesn't work? Is there anything indicating where the problem is? What's wrong? Please be more clearer.

If you're using Firefox, download the Firebug add-on, it will help you debug and determine the problem.

 

Why are you adding a submit method to a submit button/image anyway? And I very much doubt that your first one worked, seeing as the form would submit regardless.

You can doupt as much as you like but... while I am testing with button everything is ok.

 

When I try the image I must missing something so I don't get POST the checked checkboxes.

 

That is the problem. I don't get the checkboxes posted when using image button

 

Everything would be fine, because when you click the submit button, the data will be submitted regardless of whether you use an event handler or not. It doesn't matter, if you remove the onclick event handler, your form will still be submitted.

 

This works *perfectly* fine for me:

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  <input type="text" name="name" />
  <input type="image" src="http://localhost/MAMP/images/welogo.gif" name="submit" />
</form>
<?php
if(isset($_POST['submit'])) { 
  print $_POST['name'];
}
?>

this is what i have now:

 

$away8='';

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

if (isset($_POST['a'])) {
$a = $_POST['a'];

if ($a == 'a') {
$a = '1';
}
}
}

 

image button:

<input type="image" src="../../play button.bmp" height="25" width="130" name="submit" /></th>

 

still doesn't work.

 

what i understant is... when i have the simple button... ok.

 

when i am replacing with image button, somehow it is postin the first $a='' (which is null as you see) and not the other that follows if (isset($_POST['submit']))

 

Am I missing something?

 

And I asure you that with simple button works perfectly!!!

here is a small part of it:

 

<form id="form1" name="form1" method="post" action="proccess.php" target="_self">
<input type="checkbox" name="a" id="a" value="a" />
        -</span>
        <input type="checkbox" name="b" id="b" value="b" />
        <span class="style3">- </span>
        <input type="checkbox" name="c" id="c" value="c" />

I wish I could find one of the many times I've answered questions about image submit ...

 

When an image is clicked, the x and y coordinates of where it was clicked relative to its upper-left corner are passed along. That's how image maps work (and how compliant browsers treat image submits).

 

With an image submit button, $_POST['submit'] has no value. The coordinate values do exist: you can check for either $_POST['submit_x'] or $_POST['submit_y']. That'll work - assuning that you have named your image submit as you did in your first example posted code for a 'normal' submit.

Thankssssssssssssss very very much....

 

If you have time can you explain in more simple words how the image works with x & y coordinates?

 

Just to understand what happened.

 

imagined it like it scans in x & y and posting what ever it finds...

 

Thanks again

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.