als afbeelding uit map verwijderd is

Status
Niet open voor verdere reacties.
Sorry foutje
Ik ben slechtziend dus moet altijd goed blijven opletten maar het gaat wel eens mis.
 
Ik heb nou
PHP:
if (isset($_POST['reserve'])) {
  if ($_POST['type_1']  == 'type_1' && $_POST['type_2'] == 'type_2'  && $_POST['type_3'] == 'type_3') {
  echo 'Een reserve.......';
  echo $_POST['type_1'];
  echo $_POST['type_2'];
  echo $_POST['type_3'];
  echo $_POST['reserve'];
  die;
  }

maar werkt niet.
 
Deel anders ook even je hele formulier hier, dan kunnen we makkelijker kijken.
En zeg ook wat je nu precies wel en niet wilt. Dus even je vraag concreet stellen :)
 
Formulier in zijn geheel plaatsen is niet te doen

HTML:
 <form action="update.php" name="frmAdd" method="post">


<div <?= $class_hidden_type_1 ?> >
          <input  style="min-width:10px" class="radio" type="radio" name="type_1" value="type_1"  <?php  if (isset($type_1) && $type_1 == "type_1") echo "checked"; ?>>
          Ja
          <input style="min-width:10px" class="radio" type="radio" name="type_1" value="" <?php  if (isset($type_1) && $type_1 == "") echo "checked"; ?>>
          Nee </div>

<div <?= $class_hidden_type_2 ?> >
          <input  style="min-width:10px" class="radio" type="radio" name="type_2" value="type_2"  <?php  if (isset($type_2) && $type_2 == "type_2") echo "checked"; ?>>
          Ja
          <input style="min-width:10px" class="radio" type="radio" name="type_2" value="" <?php  if (isset($type_2) && $type_2 == "") echo "checked"; ?>>
          Nee </div>


<div <?= $class_hidden_type_3 ?> >
          <input  style="min-width:10px" class="radio" type="radio" name="type_3" value="type_3"  <?php  if (isset($type_3) && $type_3 == "type_1") echo "checked"; ?>>
          Ja
          <input style="min-width:10px" class="radio" type="radio" name="type_3" value="" <?php  if (isset($type_1) && $type_3 == "") echo "checked"; ?>>
          Nee </div>

// Reserve
<div>
          <input  style="min-width:10px" type ="Radio" name ="reserve" value="reserve"
<?php  if (isset($reserve) && $reserve == "reserve") echo "checked"; ?> >
          Ja
          <Input  style="min-width:10px" type ="Radio" name ="reserve" value="" 
<?php  if (isset($reserve) && $reserve == "") echo "checked"; ?>>
          Nee </div>

Er moet minstens EEN worden gekozen van de 4 anders foutmelding
type_1, type_2 en type_3 kunnen ook allemaal worden gekozen. dus 1 van de 3 , of 2 van de 3 of alle 3.

Indien men voor de laatste (volgorde) kiest mogen type_1, type_2 en type_3 niet gekozen zijn , deze kan dus maar alleen worden gekozen anders foutmelding

In update.php staat dus o,a de conditie waar we het over hebben.
 
Je kan de voorwaarde ook in een klein stukje Javascript zetten en de afhandeling in PHP.
Code:
<style>
input {cursor: pointer;}
input[disabled] {cursor: not-allowed;}
</style>

<form id="form1" method="post" action="formresult.php" enctype="multipart/form-data" onclick="checkform(this)">
  <input name="optie1" id="optie1" type="checkbox" value="optie1">
  <label  for="optie1">Optie 1</label>
  <input name="optie2" id="optie2" type="checkbox" value="optie2">
  <label  for="optie2">Optie 2</label>
  <input name="optie3" id="optie3" type="checkbox" value="optie3">
  <label  for="optie3">Optie 3</label>
  <input name="reserve" id="reserve" type="checkbox" value="reserve">
  <label  for="reserve">Reserve</label>
  <input name="submit" id="submit" type="submit" value="Verstuur" disabled>
</form>

<script>
function checkform(frm) {
  var c1=frm.optie1, c2=frm.optie2, c3=frm.optie3, cr=frm.reserve;
  frm.submit.disabled = true;
  if (cr.checked) {
    c1.checked = false;
    c2.checked = false;
    c3.checked = false;
  }
  if (c1.checked || c2.checked || c3.checked || cr.checked) {
    frm.submit.disabled = false;
  }
}
</script>
Als je reserve kiest worden optie 1,2,3 uitgezet. Je kan een optie alleen kiezen als reserve uit is.
De style is voor de juiste cursor symbolen.
 
Laatst bewerkt:
Ik vind de keuze van Bron om Javascript te gebruiken een zeer goede oplossing. Je wilt de gebruiker begeleiden om het formulier correct in te vullen, en dan het liefst ook real-time.

Uiteraard moet je er zelf voor zorgen dat je ook in het PHP-script de invoer controleert.
 
Kwestie van ook een voorbeeldje te geven

PHP:
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="content-type" content="text/html" />
	<title></title>
</head>

<body>
<style type="text/css">
<!--
	.onoff {
    display: inline-block;
	width: 80px;
	height: 25px;
	background: #707070;
	margin: 2px 2px 1px 1px;
	border-radius: 50px;
	position: relative;
    font-size: 16px;
	-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
	box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
    fill:green;
}

.onoff input[type=checkbox] {
    width: 80px;	height: 20px;    z-index: 1;
    display: block;    position: absolute;
}
.onoff+span{
    width: 80px;	height: 26px;    z-index: 2;
    display: inline-block;    position: absolute;    
}
.onoff:after {
	content: 'Nee';
	font: 12px/26px Arial, sans-serif;
	color: #FF6600;
	position: absolute;
	right: 10px;
	z-index: 0;
	font-weight: bold;
	text-shadow: 1px 1px 0px rgba(255,255,255,.15);
}
.MyIcon{
  fill: #ff0000;
}
.onoff:before {
	content: 'JA';
	font: 12px/26px Arial, sans-serif;
	color: #33cf33;
	position: absolute;
	left: 10px;
	z-index: 0;
	font-weight: bold;
}
.onoff label {
	display: block;
	width: 35px;	height: 20px;
	border-radius: 50px;
	-webkit-transition: all .4s ease;
	-moz-transition: all .4s ease;
	-o-transition: all .4s ease;
	-ms-transition: all .4s ease;
	transition: all .4s ease;
	cursor: pointer;
	position: absolute;
	top: 3px;	left: 3px;	z-index: 1;
	-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
	box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
	background: #fcfff4;
	background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bfad 100%);
	background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bfad 100%);
	background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bfad 100%);
	background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bfad 100%);
	background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bfad 100%);
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );
}
.onoff input[type=checkbox]:checked + label {
	left: 43px;
}
.onoff input[type=checkbox] {
	visibility: hidden;
    min-height: 10px;
}


-->
</style>
<?php
if(isset($_POST['verstuurd'])){
   print "POST=". print_r($_POST,true);
}
$opties[1]['ischecked']=(key_exists('optie',$_POST)&&key_exists(1,$_POST['optie']))?' checked="checked"':'';
$opties[1]['info']='-1-';
$opties[1]['label']='optie1';
$opties[2]['ischecked']=(key_exists('optie',$_POST)&&key_exists(2,$_POST['optie']))?' checked="checked"':'';
$opties[2]['info']='-2-';
$opties[2]['label']='optie2';
$opties[3]['ischecked']=(key_exists('optie',$_POST)&&key_exists(3,$_POST['optie']))?' checked="checked"':'';
$opties[3]['info']='-3-';
$opties[3]['label']='optie3';
print '<form action="'.$_SERVER["SCRIPT_NAME"].'" name="frmAdd" method="post">';
     foreach($opties as $key => $optie){?>
       <div class="form-group">
        <label class="control-label col-lg-4 col-md-4 col-sm-4" for="optie[<?php print $key;?>"> <?php print $optie['label'];?> :</label>
        <div class="onoff">
            <input class="checkbox col-lg-1" type='checkbox' id='optie[<?php print $key;?>]' name='optie[<?php print $key;?>]'  <?php print $optie['ischecked'];?>  />
            <label class="col-lg-1" for="optie[<?php print $key;?>]">
                <img  height="15" width="15" src="hetpath/naar/een/icoontje.svg"  alt="<?php print $optie['info'];?>" />
            </label>
        </div>
    </div>
<?php }?>
<input name="verstuurd" id="submit" accesskey="E" type="submit" value="Enter">
</form>    
</body>
</html>
 
Bedankt voor jullie reacties

@Bron Ik heb 2 submits met EEN krijg ik het werkend, maar niet met 2 indien mogelijk anders laat ik die Submit gewoon weg.

PHP:
   <button class="btn btn-primary"  type="submit" name="<?= $save_of_update ?>" >Bewaren &amp; Blijven</button>
            <button  class="btn btn-success"  type="submit" name="<?= $save_of_update_terug ?>" >Bewaren &amp; terugkeren naar overzicht</button>

Dan heb ik nog een
HTML:
<input  type="text"  name="nummer"  placeholder="Nummer"  value=""  autofocus/>

en

HTML:
<input  style="min-width:10px" type ="radio" name ="geslacht" value="man" >
        <Input  style="min-width:10px" type ="radio" name ="geslacht" value="vrouw" >
Zou mooi zijn die mee te nemen.



@kenikavanbis
Ziet er fraai uit maar ik weet niet hoe toe te passen.
 
Als ik mij niet vergis kan je geen twee of meer submits gebruiken. Noem het anders gewoon input type="button", en controleer met PHP aan de hand van de name en je $_SERVER['REQUEST_METHOD'] die POST is welke er is aangeklikt.
 
Ik heb een button > Bewaren
en Bewaren en terug naar overzicht

das niet zo vreemd en controle vind via javascript plaats bij voorbeeld Bron
 
Laatst bewerkt:
Dat zijn dus twee submits. Ik zou de belangrijkste een submit noemen, en de secundaire een button.
 
Meerdere submit buttons is geen probleem. In de php kan je afvangen op welke button is geklikt. Bij meerdere submit buttons wordt de javascript iets aangepast.
Code:
[B]html[/B]

<button class="btn btn-primary" type="submit" id="submit1" name="<?= $save_of_update ?>" disabled>Bewaren &amp; Blijven</button>
<button class="btn btn-success" type="submit" id="submit2" name="<?= $save_of_update_terug ?>" disabled>Bewaren &amp; Terug</button>

[B]php[/B]

if (isset($_POST[$save_of_update])) {
  // button1 geklikt
} elseif (isset($_POST[$save_of_update_terug])) {
  // button2 geklikt
}

[B]Javascript[/B]

function checkform(frm) {
  var c1=frm.optie1, c2=frm.optie2, c3=frm.optie3, cr=frm.reserve;
  frm.submit1.disabled = true;
  frm.submit2.disabled = true;
  if (cr.checked) {
    c1.checked = false;
    c2.checked = false;
    c3.checked = false;
  }
  if (c1.checked || c2.checked || c3.checked || cr.checked) {
    frm.submit1.disabled = false;
    frm.submit2.disabled = false;
  }
}

Een text input zou je zo kunnen maken.
Code:
<label  for="nummer">Nummer</label>
<input name="nummer" id="nummer" type="text" placeholder="Nummer" value="" autofocus>

De radio inputs zou je zo kunnen maken.
Code:
<div class="form-group">
  <div class="radio-inline">
    <input type="radio" name="geslacht" value="1" id="geslacht_0" checked>
    <label for="geslacht_0">Man</label>
  </div>
  <div class="radio-inline">
    <input type="radio" name="geslacht" value="2" id="geslacht_1">
    <label for="geslacht_1">Vrouw</label>
  </div>
</div>

Een iets nettere style dan in mijn eerdere post.
Code:
input[type="checkbox"], input[type="radio"] {cursor: pointer;}
input[disabled] {cursor: not-allowed;}

Suc6. Have fun.
 
Laatst bewerkt:
Het zou mooi zijn deze ook in de controle javascript mee te nemen , mij lukt dat niet,
dan is gelijk alles gecontroleerd eer de submit werkt.

HTML:
<label  for="nummer">Nummer</label>
<input name="nummer" id="nummer" type="text" placeholder="Nummer" value="" autofocus>
 
Ervan uitgaand dat nummer alleen cijfers mag bevatten dan de volgende aanpassingen
Code:
<form id="form1" method="post" action="formresult.php" enctype="multipart/form-data" onkeyup="checkform(this)" onclick="checkform(this)">

<label  for="nummer">Nummer</label>
<input name="nummer" id="nummer" type="text" placeholder="Nummer" value="" autofocus>

<script>
function checkform(frm) {
  var c1=frm.optie1, c2=frm.optie2, c3=frm.optie3, cr=frm.reserve;
  frm.submit1.disabled = true;
  frm.submit2.disabled = true;
  if (cr.checked) {
    c1.checked = false;
    c2.checked = false;
    c3.checked = false;
  }
  var isnum = /^\d+$/.test(frm.nummer.value);
  if ((c1.checked || c2.checked || c3.checked || cr.checked) && isnum) {
    frm.submit1.disabled = false;
    frm.submit2.disabled = false;
  }
}
</script>
Suc6. Have fun.
 
Beste Bron,

Mooie oplossing.

Maar als ik met button "bewaar en blijf " weer terugkom op invoergedeelte zijn de submits weer uitgeschakeld .
Er moet dan weer op een van de velden (bijv.) optie 1 worden geklikt (terwijl deze al ingevuld is) om de Buttons weer te activeren.
 
In je php bestand lees je alle post waardes in en die zet je als value weer in de html. Als voorbeeld
Code:
<?php
$nummer = '';
if (isset($_POST['nummer'])) $nummer = $_POST['nummer'];
?>
<input name="nummer" id="nummer" type="text" placeholder="Nummer" value="<?= $nummer ?>" autofocus>
 
Dus beide in het invulgedeelte zoals jij het hierboven hebt?

En als $nummer geen waarde heeft?

HTML:
<br /><b>Notice</b>:  Undefined variable: nummer in <b>/public_html/inc/inc-edit-tab-1.php</b> on line <b>16</b><br />
 
Dan zou ik met isset() kijken of deze een waarde heeft.
 
Misschien begrijp je me niet goed.

Als ik terugkom op pagina met formulier en het nummer en bijv. optie 1 is aangevinkt ,
zijn de beide submits disable ik moet dan weer de checkbox uit en aan vinken om dit weer op te heffen.

(de pagina wordt standaard ingeladen met een disable submit)
 
Laatst bewerkt:
Voorbeeld van checkbox en text input in je php bestand (wat makkelijker dan in bericht #76)
Code:
<?php
$optie1 = (isset($_POST['optie1'])) ? ' checked' : '';
$nummer = (isset($_POST['nummer'])) ? $_POST['nummer'] : '';
// enzovoort
?>
<input name="optie1" id="optie1" type="checkbox" value="optie1"<?=$optie1;?>>
<input name="nummer" id="nummer" type="text" placeholder="Nummer" value="<?=$nummer;?>" autofocus>

Direct boven </script> zodat disabled er niet is na het bewaren
Code:
form1 = document.getElementById("form1");
checkform(form1);
 
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan