Hello i am currently working with Javascript and PHP.
Now i have a form and a clickable box.
I have 2 submit buttons, and one works but the other doesn't.
When i click on the button that works it is saying that my clickable box is clicked or not.
The other should do that 2 only it doesn't.
Javascript code:
Here is the html / php code:
Sorry for the long code and the comments.
The comments are in dutch, if you have any questions about them don't be afraid to ask!
And thanks for the help!
-------------------------------------
I am a progammer.... no realy.
Now i have a form and a clickable box.
I have 2 submit buttons, and one works but the other doesn't.
When i click on the button that works it is saying that my clickable box is clicked or not.
The other should do that 2 only it doesn't.
Javascript code:
Code:
function controleer(max,minimum)
{
toegang = true;
var number = 1;
//var minimum = Math.ceil(parseInt(minimum * 1.8));
var max = parseInt(max);
var ingevuld = parseInt(document.getElementById('autobod').value);
if(isNaN(ingevuld))
{
alert('Het autobodlimiet moet een getal zijn.');
toegang = false;
}
if(ingevuld < minimum)
{
alert('Het autobodlimiet moet minimaal ' +minimum+ ' zijn.');
toegang = false;
}
if(ingevuld <= max)
{
alert('Het autobod kan alleen verhoogd worden.');
toegang = false;
}
if(toegang == true)
{
if (accept_voorwaarden.checked == 1) {
return confirm('U plaatst een bod van '+ ingevuld +', wilt u doorgaan?');
} else {
alert("De veilingvoorwaarden zijn niet geaccepteerd, uw bod kan hierdoor niet geplaatst worden.")
}
}
return toegang;
}
Here is the html / php code:
Code:
<form name="test">
<?php
// Hier kijken of er een cookie is geplaatst voor het aanvinken van deze checkbox
$id_q = "SELECT id FROM bomat_gebruikers WHERE gebruikersnaam='".$_SESSION['gebruikersnaam']."' AND actief=1 LIMIT 1";
$id_m = mysql_query($id_q);
$id_n = mysql_fetch_array($id_m);
$id_n = $id_n['id'];
$product_n = $_GET['product'];
$ch_q = "SELECT id FROM bomat_bekeken WHERE gebruikers_id='$id_n' AND product_id='$product_n'";
$ch_n = mysql_num_rows(mysql_query($ch_q));
?>
<input type="checkbox" name="accept_voorwaarden" value="ja"
<?php
if ($ch_n >= 1) {
echo ' checked="checked"';
}
?>> <?php echo $lang['pages']['veilinginfo']['ik accepteer']; ?> </td>
</form>
</tr>
<tr>
<td colspan='2' style='font-weight: bold;'><?php echo $lang['pages']['veilinginfo']['bieden']; ?> *</td>
</tr>
<?php
echo $eigenbod;
if($uwautobod != ""){
?>
<span id="autobodinfo">
<tr>
<td style='font-weight: bold;'><?php echo $lang['pages']['veilinginfo']['autobodlimiet']; ?>:</td>
<td>
<form method="post" onSubmit="return controleer(<?php echo $max; ?>,<?php echo $minimum; ?>,<?php echo $autobodmax; ?>)"> € <input type="text" value="<?php echo $max; ?>" name="autobod" id="autobod"> <input type="hidden" value="<?php echo $_GET[ 'product']; ?>" name="product">
<input style="background: #e12d2d" type="submit" name="editautobod" value="<?php echo $lang['pages']['veilinginfo']['wijzig']; ?>">
</form>
</tr>
</span>
<?php
}
$koopbedrag = mysql_fetch_array(mysql_query("SELECT * FROM bomat_producten WHERE id='".$_GET['product']."' AND actief=1"));
$button = koopnubutton($lang['pages']['veilinginfo']['koopbedrag'],$koopbedrag['koopbedrag']);
if (is_numeric($kosten['veilingvoorwaarde'])) {
//echo "Gezet: buttons ZONDER extra veilingsvoorwaarden.<br>";
$submitbutton = '<input onMouseOver="this.style.cursor=\\\'pointer\\\'" type="submit" style="background-color:#e12d2d" name="bieden" value="'. $lang['pages']['veilinginfo']['plaatsbodsubmit'].'">';
$autobodbutton = '<input onMouseOver="this.style.cursor=\\\'pointer\\\'" type="submit" style="background-color:#e12d2d" name="autobieden" value="'.$lang['pages']['veilinginfo']['autobodsubmit'].'">';
$alertkoopnu = '<a onMouseOver="this.style.cursor=\\\'pointer\\\'" onClick="return confirm(\\\''.$lang['pages']['veilinginfo']['weetuzeker'].'\\\')" href="index.php?p=koopnu_submitted&id='.$koopbedrag['id'].'&vi='.$koopbedrag['veiling'].'">'.$button.'</a>';
} else {
//echo "Gezet: buttons MET extra veilingsvoorwaarden.<br>";
// KIJKEN OF ER IN DE DATABASE STAAT OF DE GEBRUIKER DE VOORWAARDEN AL HEEFT GELEZEN
// - Dit moet in p=bieden_submitted opgeslagen worden
$id_q = "SELECT id FROM bomat_gebruikers WHERE gebruikersnaam='".$_SESSION['gebruikersnaam']."' AND actief=1 LIMIT 1";
$id_m = mysql_query($id_q);
$id_n = mysql_fetch_array($id_m);
$id_n = $id_n['id'];
$product_n = $_GET['product'];
$ch_q = "SELECT id FROM bomat_bekeken WHERE gebruikers_id='$id_n' AND product_id='$product_n'";
$ch_n = mysql_num_rows(mysql_query($ch_q));
// echo $ch_n;
if ($ch_n >= 1) {
// de veilingsvoorwaarden zijn al eens bekeken
$submitbutton = '<input onMouseOver="this.style.cursor=\\\'pointer\\\'" type="submit" style="background-color:#e12d2d" name="bieden" value="'. $lang['pages']['veilinginfo']['plaatsbodsubmit'].'">';
$autobodbutton = '<input onMouseOver="this.style.cursor=\\\'pointer\\\'" type="submit" style="background-color:#e12d2d" name="autobieden" value="'.$lang['pages']['veilinginfo']['autobodsubmit'].'">';
$alertkoopnu = '<a onMouseOver="this.style.cursor=\\\'pointer\\\'" onClick="return confirm(\\\''.$lang['pages']['veilinginfo']['weetuzeker'].'\\\')" href="index.php?p=koopnu_submitted&id='.$koopbedrag['id'].'&vi='.$koopbedrag['veiling'].'">'.$button.'</a>';
} else {
// $submitbutton = '<input onMouseOver="this.style.cursor=\\\'pointer\\\'" onClick="return confirm(\\\'' . $lang['pages']['veilinginfo']['acceptvoorwaarde'].'\\\')" style="background-color:#e12d2d" type="submit" name="bieden" value="'.$lang['pages']['veilinginfo']['plaatsbodsubmit'].'">';
$submitbutton = '<input onMouseOver="this.style.cursor=\\\'pointer\\\'" style="background-color:#e12d2d" type="submit" name="bieden" value="'.$lang['pages']['veilinginfo']['plaatsbodsubmit'].'">';
// $autobodbutton = '<input onMouseOver="this.style.cursor=\\\'pointer\\\'" onClick="return confirm(\\\''.$lang['pages']['veilinginfo']['acceptvoorwaarde'].'\\\')" type="submit" style="background-color:#e12d2d" name="autobieden" value="'.$lang['pages']['veilinginfo']['autobodsubmit'].'">';
$autobodbutton = '<input onMouseOver="this.style.cursor=\\\'pointer\\\'" type="submit" style="background-color:#e12d2d" name="autobieden" value="'.$lang['pages']['veilinginfo']['autobodsubmit'].'">';
// $alertkoopnu = '<a onMouseOver="this.style.cursor=\\\'pointer\\\'" onClick="return confirm(\\\''.$lang['pages']['veilinginfo']['acceptvoorwaarde'].' '.$lang['pages']['veilinginfo']['weetuzeker'].'\\\')" href="index.php?p=koopnu_submitted&id='.$koopbedrag['id'].'&vi='.$koopbedrag['veiling'].'">'.$button.'</a>';
$alertkoopnu = '<a onMouseOver="this.style.cursor=\\\'pointer\\\'" href="index.php?p=koopnu_submitted&id='.$koopbedrag['id'].'&vi='.$koopbedrag['veiling'].'">'.$button.'</a>';
$extra_voorwaarden = "ja";
}
}
?>
<input type='hidden' value='<?php echo $uwautobod; ?>' id='uwautobod'>
<form name="bod_form" method='post' action='index.php?p=bieden_submitted<?php if ($extra_voorwaarden == "ja") { echo '&extra=ja&gbid='.$id_n.'&productid='.$product_n; } ?>' onSubmit="return checkbod('<?php echo $startprijs; ?>','<?php echo $hoogstebod; ?>','<?php echo $user; ?>','<?php echo $percentage; ?>','<?php echo $minimum; ?>')">
<input type='hidden' value='<?php echo $_GET['product']; ?>' name='id'>
<input type='hidden' name='ip' value='<?php echo $_SERVER['REMOTE_ADDR']; ?>'>
<tr>
<td style='font-weight: bold;'><?php echo $lang['pages']['veilinginfo']['plaatsbod']; ?>: <img style='cursor:pointer' title='<?php echo $lang['nieuws']['klikbieden']; ?>' src='img/layout/content/table/questionmark.gif' onClick="quickinfo('300','150','inc/quickinfo.php?info=bieden')"></td>
<td><input id='bod' maxlength='10' name='bod' value='<?php echo $minimum; ?>' type='text'></td>
</tr>
<tr>
<td> </td>
<?php
////////////// Hieronder word de submitbutton weergegeven //////////////////
// De submitbutton geeft de confirm, wat gebeurt er wanneer er op OK word gedrukt?
// Eigenlijk moet de confirm vervangen worden door een functie waar gekeken word of de veilingvoorwaarden zijn aangefinkt,
// en dan verder gaat. Na de confirm gaat de pagina verder naar bieden_submitted, kijken wat daar word gechecked
// Ook staat er in functies.js een controle, deze word na de confirm weergegeven
?>
<td><script language="javascript">document.write('<?php echo $submitbutton; ?>')</script><noscript><b>JavaScript</b></noscript></td>
</tr>
</form>
<?php
if($uwautobod == ""){
?>
<form method='post' action='index.php?p=autobod_submitted' onSubmit="return checkautobod('<?php echo $hoogstebod; ?>','<?php echo $user; ?>','<?php echo $minimum; ?>','<?php echo $autobodbestaatal; ?>','<?php echo $autobodmax; ?>')">
<input type='hidden' value='<?php echo $_GET['product']; ?>' name='id'>
<input type='hidden' name='ip' value='<?php echo $_SERVER['REMOTE_ADDR']; ?>'>
<tr>
<td style='font-weight: bold;'><?php echo $lang['pages']['veilinginfo']['autobod']; ?>: <img title='<?php echo $lang['nieuws']['klikautobod']; ?>' style='cursor:pointer' src='img/layout/content/table/questionmark.gif' onClick="window.open('inc/quickinfo.php?info=autobod','asd','width=400,height=160')"></td>
<td><input id='autobod' maxlength='10' name='autobod' type='text'></td>
</tr>
<tr>
<td> </td>
<td><script language="javascript">document.write('<?php echo $autobodbutton; ?>')</script><noscript><b>JavaScript</b></noscript></td>
</tr>
</form>
Sorry for the long code and the comments.
The comments are in dutch, if you have any questions about them don't be afraid to ask!
And thanks for the help!
-------------------------------------
I am a progammer.... no realy.