...

View Full Version : Submit button on form not working



tomraffe
05-11-2009, 11:47 PM
Can anyone tell me why the submit button on this form does not work?

See http://www.spendandgive.biz/original.php

The form works perfectly on its own http://www.spendandgive.biz/table.php but not when I paste it in to the template.

timgolding
05-11-2009, 11:51 PM
its not nested inside a form tag for starters
http://www.w3schools.com/TAGS/tag_form.asp

tomraffe
05-12-2009, 12:01 AM
That seems to have fixed it! Thanks.

Anyone any idea why a number shows after I submit the form?

www.spendandgive.biz/original1.php (http://www.spendandgive.biz/original1.php)

_Aerospace_Eng_
05-12-2009, 06:41 AM
I can't seem to duplicate the "number" issue in your form.

tomraffe
05-12-2009, 09:31 AM
Okay you cant get past the validation step in IE, but as the validation doesnt work in FF you can get to the next step.

Repro Steps

1. Go to http://www.spendandgive.biz/original1.php in Firefox
2. Select a shop
3. Press the Submit (Spend and Give) button

You will see that briefly a blank page with a number in the top left corner is displayed before you are redirected to the next page. This only displays for a couple of seconds at most so blink and you'll miss it!

_Aerospace_Eng_
05-12-2009, 09:36 AM
You will need to post the php for index.php

tomraffe
05-12-2009, 11:18 AM
<? session_start();
error_reporting(0);

include "config.php";
include "functions/functions.php";
include "db/db.inc.php";


// delete selected
echo $yo=$_REQUEST['shop'];
if($_POST['DelSel']){

$var ="select * from ".SHOP." where shop_name = '".$_POST['search']."'";
$ser=mysql_query( $var );
$rs1 = mysql_fetch_array( $ser );


}
// Activate selected
if($_POST['ActSel']){

$var1 ="select * from ".SHOP." where shop_id = '".$_POST['shop']."'";
$ser1=mysql_query( $var1 );
$rs1 = mysql_fetch_array( $ser1 );
$var2 ="select * from ".CHARITY." where charity_id = '".$_POST['charity']."'";
$ser2=mysql_query( $var2 );
$rs2 = mysql_fetch_array( $ser2 );
$peg1=$rs1['shop_url'];
$peg2=$rs2['charity_url'];
$peg=$peg1."".$peg2;
{
redirect($peg);
}


}



?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--

Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Title : Cloudy
Version : 1.0
Released : 20081214
Description: A two-column, fixed-width and lightweight template ideal for 1024x768 resolutions. Suitable for blogs and small websites.

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Cloudy by Free Css Templates</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- start header -->
<div id="wrapper">
<div id="logo">
<h1><a href="#">Cloudy </a></h1>
<h2> &raquo;&nbsp;&nbsp;&nbsp;Design by Free Css Templates</h2>
</div>

<form id="form1" name="form1" method='post' action="index.php" onSubmit="return validate2();">

<div><center><table width="713" border="0" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
<tr valign="top" height="50">
<td><center>
<font color="#000000">
1. <select name='shop' class="bodytxt" size="1" id="shop_id" onChange="return select_server();">
<option>---Select your shop----</option>
<?php $sql = mysql_query("select * from ".SHOP." order by shop_name asc ") or die( mysql_error());
while($rs = mysql_fetch_array( $sql )){
?>
<option value="<?=$rs['shop_id']?>"><?=$rs['shop_name']?></option>
<?php
}
?>
</select>

</td>
<td><center>
<font color="#000000">
2. <select name="charity" class="bodytxt" size="1">
<option>---Select your charity----</option>
<?php $sql = mysql_query("select * from ".CHARITY." order by charity_name asc ") or die( mysql_error());
while($rs = mysql_fetch_array( $sql )){
?>
<option value="<?=$rs['charity_id']?>"><?=$rs['charity_name']?></option>
<?php
}
?>
</select>

</td>
</tr>
<tr valign="top" height="30">
<TD COLSPAN="2"><center>

<font color="#000000"><div id='ajaxDiv'></div></font>

</td>
</tr>

</td>
</tr>
<tr valign="top" height="50">
<TD COLSPAN="2"><center><br>
<font color="#000000">
3. <span class="smalltxt"><input name="ActSel" type="submit" class="black-text" id="active" value="Spend And Give">

</td>
</tr>
</table>
</center>
</form>

</div>
<div id="header">
<div id="menu">
<ul>
<li class="current_page_item"><a href="#">Homepage</a></li>
<li><a href="#">Blogs</a></li>
<li><a href="#">Photos</a></li>
<li><a href="#">About</a></li>
<li class="last"><a href="#">Contact</a></li>
</ul>
</div>
</div>
<!-- end header -->
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="content">
<div class="post">
<h1 class="title">Welcome to our website </h1>
<div class="entry">
<p>This is Cloudy, is a free template from <a href="http://freecsstemplates.org/">Free CSS Templates</a> released under a <a href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>. The flower photo is fromt <a href="http://www.pdphoto.org/">PDPhoto.org</a>. You're free to use this template for both commercial or personal use. I only ask that you link back to <a href="http://freecsstemplates.org/">my site</a> in some way. Enjoy :)</p>
</div>
<div class="meta">
<p class="byline">Posted by FreeCssTemplates</p>
<p class="links"><a href="#" class="more">Read full article</a> &raquo;&nbsp;&nbsp;&nbsp;<a href="#" class="comments">Comments (32)</a></p>
</div>
</div>
<div class="post">
<h2 class="title">Lorem Ipsum Dolor Volutpat</h2>
<div class="entry">
<p>Curabitur tellus. Phasellus tellus turpis, iaculis in, faucibus lobortis, posuere in, lorem. Donec a ante. Donec neque purus, adipiscing id, eleifend a, cursus vel, odio. Vivamus varius justo sit amet leo. Morbi sed libero. Vestibulum blandit augue at mi. Praesent fermentum lectus eget diam. Nam cursus, orci sit amet porttitor iaculis, ipsum massa aliquet nulla, non elementum mi elit a mauris. </p>
</div>
<div class="meta">
<p class="byline">Posted by FreeCssTemplates</p>
<p class="links"><a href="#" class="more">Read full article</a> &raquo;&nbsp;&nbsp;&nbsp;<a href="#" class="comments">Comments (32)</a></p>
</div>
</div>
</div>
<!-- end content -->
<!-- start sidebar -->
<div id="sidebar">
<ul>
<li id="search">
<h2>Search</h2>
<form method="get" action="">
<fieldset>
<input type="text" id="s" name="s" value="" />
<input type="submit" id="x" value="Search" />
</fieldset>
</form>
</li>
<li>
<h2>Lorem Ipsum</h2>
<ul>
<li><a href="#">Fusce dui neque fringilla</a></li>
<li><a href="#">Eget tempor eget nonummy</a></li>
<li><a href="#">Magna lacus bibendum mauris</a></li>
<li><a href="#">Nec metus sed donec</a></li>
<li><a href="#">Magna lacus bibendum mauris</a></li>
<li><a href="#">Velit semper nisi molestie</a></li>
<li><a href="#">Eget tempor eget nonummy</a></li>
</ul>
</li>
<li>
<h2>Volutpat Dolore</h2>
<ul>
<li><a href="#">Nec metus sed donec</a></li>
<li><a href="#">Magna lacus bibendum mauris</a></li>
<li><a href="#">Velit semper nisi molestie</a></li>
<li><a href="#">Eget tempor eget nonummy</a></li>
<li><a href="#">Nec metus sed donec</a></li>
<li><a href="#">Magna lacus bibendum mauris</a></li>
<li><a href="#">Velit semper nisi molestie</a></li>
</ul>
</li>
</ul>
</div>
<!-- end sidebar -->
<div style="clear: both;">&nbsp;</div>
</div>
<!-- end page -->
<!-- start footer -->
<div id="footer">
<p id="legal">( c ) 2008. All Rights Reserved. <a href="http://www.freecsstemplates.org/">Bestfriends</a> designed by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
</div>
</div>
<!-- end footer -->
</body>
</html>

<script>

function validate2(){

if(document.form1.shop.value == ''){
alert('Please select shop!!');
document.form1.shop.focus();
return false;
}
if(document.form1.charity.value == ''){
alert('Please select Charity');
document.form1.charity.focus();
return false;
}



}
</script>

<script>
// ajax
var http = getHTTPObject();
var url = "azax_select.php?server_id=";


function getHTTPObject() {
var xmlhttp;

if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}
else if (window.ActiveXObject){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
if (!xmlhttp){
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}

}
return xmlhttp;
}

function appendOptionLast(num)
{
var elOptNew = document.createElement('option');
elOptNew.text = '---' + num + '---';
elOptNew.value = num;
var elSel = document.getElementById('shop_id');
try {
elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
}
catch(ex) {
elSel.add(elOptNew); // IE only
}
}

function removeOptionLast(num)
{
var elSel = document.getElementById('shop_id');

for(var i=num-1;i>=0;i--)
{

elSel.remove(i);
}
}


function select_server()
{
var sId =document.getElementById('shop_id').value;
var full_url = url+escape(sId);

http.open("GET",full_url,true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}


function handleHttpResponse()
{
if (http.readyState == 4)
{
if(http.status==200)
{
var results=http.responseText;

var num;
//var elOptNew = document.createElement('option');

//var elSel = document.getElementById('shop_id');
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = http.responseText;

num=results.split(",");

if(elSel.length>0)
{

removeOptionLast(elSel.length);

}
for(var i=0;i<num.length;i++)
{
appendOptionLast(num[i]);
}



}
}
}


</script>

_Aerospace_Eng_
05-12-2009, 12:01 PM
What are you doing here?

{
redirect($peg);
}
There is no conditional statement belonging to those brackets so it should be erroring out. Please post the code for your redirect function. Also I suggest you look into mysql injection: http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php

tomraffe
05-12-2009, 12:59 PM
I didnt code this, it was outsourced as my skills dont stretch much beyond basic HTML/CSS.

Im having server problems at the moment but once we're back up I'll get you the rest of the code. I have a functions.php which I guess is what you're after.

_Aerospace_Eng_
05-12-2009, 04:00 PM
Whoever you paid did a poor job in taking security into account. I recommend not using them again for their services.

tomraffe
05-12-2009, 04:16 PM
I paid 30 to an Indian, but you get what you pay for I guess!

timgolding
05-12-2009, 04:26 PM
I could of found you a far better programmer for 30 an hour. You really need to fix those queries. It hurts my eyes to look at those. Read the article about mysql_injections that _Aerospace_Eng_ posted. And look at http://uk.php.net/manual/en/function.mysql-real-escape-string.php. Its really just a case of real escaping or (validating) your post data. I suggest you fix this fast. As you've just posted a link to your insecure site and shown us the insecure code. Therefore any hacker that looks at this thread can either completely destroy (drop) your database, empty it or gain access to any information stored in it. I could do it now if i was hacker would take me 5 minutes.

If you really think you can't cope with doing it yourself I will provide the codes myself free of charge. It hurts my eyes that much lol

tomraffe
05-12-2009, 05:08 PM
I paid 30 for the whole project, not per hour, or maybe you mean this could be done in an hour...

timgolding
05-12-2009, 05:18 PM
<?
function escape_str($string) {

if ( function_exists('mysql_real_escape_string') ) {

return mysql_real_escape_string( stripslashes($string) );

} else {

return addslashes( stripslashes($string) );

}

}

session_start();
error_reporting(0);

include "config.php";
include "functions/functions.php";
include "db/db.inc.php";


// delete selected
echo $yo=$_REQUEST['shop'];
if($_POST['DelSel']){
//Bit concerned about SHOP and CHARITY but aslong as these are defined with hardcoded strings and not post data will be fine.
// but would need access to these definitions to be sure. If they are coming from POST i got a backticker somewhere
$var ="select * from ".SHOP." where shop_name = '".escape_str($_POST['search'])."'";
$ser=mysql_query( $var );
$rs1 = mysql_fetch_array( $ser );


}
// Activate selected
if($_POST['ActSel']){

$var1 ="select * from ".SHOP." where shop_id = '".escape_str($_POST['shop'])."'";
$ser1=mysql_query( $var1 );
$rs1 = mysql_fetch_array( $ser1 );
$var2 ="select * from ".CHARITY." where charity_id = '".escape_str($_POST['charity'])."'";
$ser2=mysql_query( $var2 );
$rs2 = mysql_fetch_array( $ser2 );
$peg1=$rs1['shop_url'];
$peg2=$rs2['charity_url'];
$peg=$peg1."".$peg2;
{
redirect($peg);
}


}



?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--

Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Title : Cloudy
Version : 1.0
Released : 20081214
Description: A two-column, fixed-width and lightweight template ideal for 1024x768 resolutions. Suitable for blogs and small websites.

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Cloudy by Free Css Templates</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- start header -->
<div id="wrapper">
<div id="logo">
<h1><a href="#">Cloudy </a></h1>
<h2> &raquo;&nbsp;&nbsp;&nbsp;Design by Free Css Templates</h2>
</div>

<form id="form1" name="form1" method='post' action="index.php" onSubmit="return validate2();">

<div><center><table width="713" border="0" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
<tr valign="top" height="50">
<td><center>
<font color="#000000">
1. <select name='shop' class="bodytxt" size="1" id="shop_id" onChange="return select_server();">
<option>---Select your shop----</option>
<?php $sql = mysql_query("select * from ".SHOP." order by shop_name asc ") or die( mysql_error());
while($rs = mysql_fetch_array( $sql )){
?>
<option value="<?=$rs['shop_id']?>"><?=$rs['shop_name']?></option>
<?php
}
?>
</select>

</td>
<td><center>
<font color="#000000">
2. <select name="charity" class="bodytxt" size="1">
<option>---Select your charity----</option>
<?php $sql = mysql_query("select * from ".CHARITY." order by charity_name asc ") or die( mysql_error());
while($rs = mysql_fetch_array( $sql )){
?>
<option value="<?=$rs['charity_id']?>"><?=$rs['charity_name']?></option>
<?php
}
?>
</select>

</td>
</tr>
<tr valign="top" height="30">
<TD COLSPAN="2"><center>

<font color="#000000"><div id='ajaxDiv'></div></font>

</td>
</tr>

</td>
</tr>
<tr valign="top" height="50">
<TD COLSPAN="2"><center><br>
<font color="#000000">
3. <span class="smalltxt"><input name="ActSel" type="submit" class="black-text" id="active" value="Spend And Give">

</td>
</tr>
</table>
</center>
</form>

</div>
<div id="header">
<div id="menu">
<ul>
<li class="current_page_item"><a href="#">Homepage</a></li>
<li><a href="#">Blogs</a></li>
<li><a href="#">Photos</a></li>
<li><a href="#">About</a></li>
<li class="last"><a href="#">Contact</a></li>
</ul>
</div>
</div>
<!-- end header -->
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="content">
<div class="post">
<h1 class="title">Welcome to our website </h1>
<div class="entry">
<p>This is Cloudy, is a free template from <a href="http://freecsstemplates.org/">Free CSS Templates</a> released under a <a href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a>. The flower photo is fromt <a href="http://www.pdphoto.org/">PDPhoto.org</a>. You're free to use this template for both commercial or personal use. I only ask that you link back to <a href="http://freecsstemplates.org/">my site</a> in some way. Enjoy :)</p>
</div>
<div class="meta">
<p class="byline">Posted by FreeCssTemplates</p>
<p class="links"><a href="#" class="more">Read full article</a> &raquo;&nbsp;&nbsp;&nbsp;<a href="#" class="comments">Comments (32)</a></p>
</div>
</div>
<div class="post">
<h2 class="title">Lorem Ipsum Dolor Volutpat</h2>
<div class="entry">
<p>Curabitur tellus. Phasellus tellus turpis, iaculis in, faucibus lobortis, posuere in, lorem. Donec a ante. Donec neque purus, adipiscing id, eleifend a, cursus vel, odio. Vivamus varius justo sit amet leo. Morbi sed libero. Vestibulum blandit augue at mi. Praesent fermentum lectus eget diam. Nam cursus, orci sit amet porttitor iaculis, ipsum massa aliquet nulla, non elementum mi elit a mauris. </p>
</div>
<div class="meta">
<p class="byline">Posted by FreeCssTemplates</p>
<p class="links"><a href="#" class="more">Read full article</a> &raquo;&nbsp;&nbsp;&nbsp;<a href="#" class="comments">Comments (32)</a></p>
</div>
</div>
</div>
<!-- end content -->
<!-- start sidebar -->
<div id="sidebar">
<ul>
<li id="search">
<h2>Search</h2>
<form method="get" action="">
<fieldset>
<input type="text" id="s" name="s" value="" />
<input type="submit" id="x" value="Search" />
</fieldset>
</form>
</li>
<li>
<h2>Lorem Ipsum</h2>
<ul>
<li><a href="#">Fusce dui neque fringilla</a></li>
<li><a href="#">Eget tempor eget nonummy</a></li>
<li><a href="#">Magna lacus bibendum mauris</a></li>
<li><a href="#">Nec metus sed donec</a></li>
<li><a href="#">Magna lacus bibendum mauris</a></li>
<li><a href="#">Velit semper nisi molestie</a></li>
<li><a href="#">Eget tempor eget nonummy</a></li>
</ul>
</li>
<li>
<h2>Volutpat Dolore</h2>
<ul>
<li><a href="#">Nec metus sed donec</a></li>
<li><a href="#">Magna lacus bibendum mauris</a></li>
<li><a href="#">Velit semper nisi molestie</a></li>
<li><a href="#">Eget tempor eget nonummy</a></li>
<li><a href="#">Nec metus sed donec</a></li>
<li><a href="#">Magna lacus bibendum mauris</a></li>
<li><a href="#">Velit semper nisi molestie</a></li>
</ul>
</li>
</ul>
</div>
<!-- end sidebar -->
<div style="clear: both;">&nbsp;</div>
</div>
<!-- end page -->
<!-- start footer -->
<div id="footer">
<p id="legal">( c ) 2008. All Rights Reserved. <a href="http://www.freecsstemplates.org/">Bestfriends</a> designed by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>
</div>
</div>
<!-- end footer -->
</body>
</html>

<script>

function validate2(){

if(document.form1.shop.value == ''){
alert('Please select shop!!');
document.form1.shop.focus();
return false;
}
if(document.form1.charity.value == ''){
alert('Please select Charity');
document.form1.charity.focus();
return false;
}



}
</script>

<script>
// ajax
var http = getHTTPObject();
var url = "azax_select.php?server_id=";


function getHTTPObject() {
var xmlhttp;

if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}
else if (window.ActiveXObject){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
if (!xmlhttp){
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}

}
return xmlhttp;
}

function appendOptionLast(num)
{
var elOptNew = document.createElement('option');
elOptNew.text = '---' + num + '---';
elOptNew.value = num;
var elSel = document.getElementById('shop_id');
try {
elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
}
catch(ex) {
elSel.add(elOptNew); // IE only
}
}

function removeOptionLast(num)
{
var elSel = document.getElementById('shop_id');

for(var i=num-1;i>=0;i--)
{

elSel.remove(i);
}
}


function select_server()
{
var sId =document.getElementById('shop_id').value;
var full_url = url+escape(sId);

http.open("GET",full_url,true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}


function handleHttpResponse()
{
if (http.readyState == 4)
{
if(http.status==200)
{
var results=http.responseText;

var num;
//var elOptNew = document.createElement('option');

//var elSel = document.getElementById('shop_id');
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = http.responseText;

num=results.split(",");

if(elSel.length>0)
{

removeOptionLast(elSel.length);

}
for(var i=0;i<num.length;i++)
{
appendOptionLast(num[i]);
}



}
}
}


</script>

tomraffe
05-18-2009, 11:04 PM
Server back up, we still have the problem of the number being displayed after the form is submitted. See above for repro steps.

http://www.twrnet.co.uk/spendandgive.biz/

PappaJohn
05-18-2009, 11:16 PM
Possibly this line:

echo $yo=$_REQUEST['shop'];

I haven't gone over all the code but you aren't using the $yo variable anywhere, so it looks like a good candidate.

tomraffe
05-19-2009, 01:24 PM
Possibly this line:

echo $yo=$_REQUEST['shop'];

I haven't gone over all the code but you aren't using the $yo variable anywhere, so it looks like a good candidate.

Cool. I didnt code it myself and arent familiar with PHP but if you could provide any more info on what needs doing that would be great, or even edit the line yourself if you're feeling generous :)

_Aerospace_Eng_
05-19-2009, 01:49 PM
Just remove that line. Plain and simple. Or to be safe just in case it is used somewhere else remove echo.

tomraffe
05-19-2009, 02:20 PM
Seems like thats done the trick, thanks all!

tomraffe
05-21-2009, 12:09 PM
I'm having a similar, but much simpler problem. I changed the default Submit button for a custom image button but the script has stopped working now. It did work fine with the default but with the custom button the form just resets, here is the form code with the custom button


<form id="form1" name="form1" method='post' action="index.php" onSubmit="return validate2();"> <div><center><table width="713" border="0" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
<tr valign="top" height="50">
<td><center>
<font color="#000000">
1. <select name='shop' class="bodytxt" size="1" id="shop_id" onChange="return select_server();">
<option>---Select your shop----</option>
<?php $sql = mysql_query("select * from ".SHOP." order by shop_name asc ") or die( mysql_error());
while($rs = mysql_fetch_array( $sql )){
?>
<option value="<?=$rs['shop_id']?>"><?=$rs['shop_name']?></option>
<?php
}
?>
</select>

</td>
<td><center>
<font color="#000000">
2. <select name="charity" class="bodytxt" size="1">
<option>---Select your charity----</option>
<?php $sql = mysql_query("select * from ".CHARITY." order by charity_name asc ") or die( mysql_error());
while($rs = mysql_fetch_array( $sql )){
?>
<option value="<?=$rs['charity_id']?>"><?=$rs['charity_name']?></option>
<?php
}
?>
</select>

</td>
</tr>
<tr valign="top" height="30">
<TD COLSPAN="2"><center>

<font color="#000000"><div id='ajaxDiv'></div></font>

</td>
</tr>

</td>
</tr>
<tr valign="top" height="50">
<TD COLSPAN="2"><center><br>
<font color="#000000">

<input name="ActSel" type="image" src="3.jpg" style="border:0;" class="black-text" id="active"/>

</td>
</tr>
</table>
</center>
</form>

Here is the form code with the default button


<form id="form1" name="form1" method='post' action="index.php" onSubmit="return validate2();">

<div><center><table width="713" border="0" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
<tr valign="top" height="50">
<td><center>
<font color="#000000">
1. <select name='shop' class="bodytxt" size="1" id="shop_id" onChange="return select_server();">
<option>---Select your shop----</option>
<?php $sql = mysql_query("select * from ".SHOP." order by shop_name asc ") or die( mysql_error());
while($rs = mysql_fetch_array( $sql )){
?>
<option value="<?=$rs['shop_id']?>"><?=$rs['shop_name']?></option>
<?php
}
?>
</select>

</td>
<td><center>
<font color="#000000">
2. <select name="charity" class="bodytxt" size="1">
<option>---Select your charity----</option>
<?php $sql = mysql_query("select * from ".CHARITY." order by charity_name asc ") or die( mysql_error());
while($rs = mysql_fetch_array( $sql )){
?>
<option value="<?=$rs['charity_id']?>"><?=$rs['charity_name']?></option>
<?php
}
?>
</select>

</td>
</tr>
<tr valign="top" height="30">
<TD COLSPAN="2"><center>

<font color="#000000"><div id='ajaxDiv'></div></font>

</td>
</tr>

</td>
</tr>
<tr valign="top" height="50">
<TD COLSPAN="2"><center><br>
<font color="#000000">
3. <span class="smalltxt"><input name="ActSel" type="submit" class="black-text" id="active" value="Spend And Give">

</td>
</tr>
</table>
</center>
</form>

Or try it yourself at SpendandGive.biz

_Aerospace_Eng_
05-21-2009, 03:38 PM
The problem with an image submit button is the coordinates on where the user clicked on the button are passed so you need to check for

if(isset($_POST['ActSel_x']) && isset($_POST['ActSel_y']))
{
// do your php stuff here
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum