Jump to content

help with a php form please


monkeymade

Recommended Posts

ok, I'm sure this is something simple I'm doing wrong, it always is lol.

 

I'm making a form, instead of a normal submit button, I am using an image.  The code for the submit button is this:

 

<input type="image" src="images/savedata.jpg" border="0" name="submit" value="test">

 

Then, I try and retrieve the value of it.  I have more than one form on the page, and I do it this way so I know which form was filled out:

 

<?PHP
$submit = $_REQUEST['submit'];
echo "the value of submit is $submit";
?>

 

This should echo out the word "test" since thats the value I assigned to the button (or so I'd hoped), but instead it comes out blank.

 

I've also tried

 

$submit = $_POST['submit'];

 

Thinking that maybe request just wasn't working in this instance, but still with no luck.  Anyone know what I am doing wrong here?  Or if this can even be done?  Thanks for your help!

Link to comment
Share on other sites

nope RedArrow, that didn't do it either, just scrunched up my image lol.

 

I don't know if it will help at all, but this is the page I am using it on:

 

http://admin.dadnladlawnservice.com/customermaint.php

 

There are 5 images at the bottom, each will be a "submit button" and each will do different things, this is why I am not using a hidden field, because its basically just 1 form, with 5 different submit buttons.  A hidden field would get entered with all 5, and not tell me which one was pushed.

 

I haven't added the security part yet, so its open to anyone to look at it, if you can help with this that would be great!

Link to comment
Share on other sites

you can not name the image submit button example and try!

 

working example with image as submit button


<?php
$name=$_POST['name'];
if($name){
echo $name;
}
?>


<form method="POST" action=" ">
<br>
<br>
your name please
<br><br>
<input type="text" name="name">
<br><br>
<INPUT TYPE="image" SRC="http://z.about.com/d/paranormal/1/0/4/S/myrtle_ghost.jpg" HEIGHT="10%" WIDTH="10%" BORDER="0" ALT="Submit Form">
</form>

Link to comment
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.