I have a submit form and i want to use an image button but i can't , in a html file is working fine but in a php file nothing happens. How to create an image submit button in a php file ? thank you
can you pls show your php file code ? may be you are missing something... such as use of <form> tag...
are you seeing an error of some kind? can you show us the source... maybe you need to echo it .. echo("<input type='image' src='image/url.gif' />"); PHP:
<?php if(isset($_POST["send"])) { $name = $_POST["name"]; $url = $_POST["url"]; $email = $_POST["email"]; $subject = $_POST["subject"]; $msg = $_POST["msg"]; $ip = $_SERVER['REMOTE_ADDR']; $receiver = "email@domain.com"; if(empty($name)) { echo(" - There was no name!<br />"); } // CHECK IF EMAIL IS VALID //////////////////////////////////////////////////////////////////// function CheckMail($email) { if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$", $email)) { return true; } else { return false; } } if ((empty($email)) || (!CheckMail($email))) { Die(" - Please go back and fill in a valid e-mail adress!"); } // CHECK IF EMAIL IS VALID //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// // CHECK IF THE FORM HAS BEEN FILLED if(empty($subject)){ echo(" - There was no subject!<br />"); } if(empty($msg)){ echo(" - There was no message!<br />"); } //////////////////////////////////////////////////////////////////// // IF THEIR ARE NOT EMPTY if(!empty($name) && !empty($email) && !empty($subject) && !empty($msg)) { $headers .= "From: ".$email.""; // WE STORE THE MESSAGE IN A VARIABLE $messageproper = "This message was sent from: $name - $email \n" . "URL\n" . "------------------------- Form Mail-------------------------\n\n" . "Name: $name\n" . "Site Url: $url\n" . "Email: $email\n" . "Message: $msg\n" . "Sender Ip: $ip\n" . "\n------------------------------------------------------------\n"; mail("$receiver", $subject, $messageproper, "From: Mail Form < $email>"); echo( '<br /> ---------------------------------------------------------------------------------------------------------------<br /> Thank you <strong>' . $name . '</strong>, your email was sent! And your IP has been logged <strong> IP: ' .$ip .'</strong><br /> ---------------------------------------------------------------------------------------------------------------<br />' ); } } ?> <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <strong>Name:</strong><br /> <input type="text" name="name" size="35" /><br /> <strong>Site Url:</strong>*<br /> <input type="text" name="url" size="35" /><br /> <strong>E-mail:</strong><br /> <input type="text" name="email" size="35" /><br /> <strong>Subject:</strong><br /> <input type="text" name="subject" size="35" /><br /> <strong>Message:</strong><br /> <textarea name="msg" rows="8" cols="42"></textarea><br /> <input name="send" type="image" src="images/button.png" value="Send Email"/> </form> PHP: Your name of the image input was "Send", and your php code checked with if(isset($_POST["send"])) Since that's a case-sensitive string, "Send" == "send" will return false