Als hij er een kiest: het paar

Gestart doorSanderc5 reacties6 weergaven

6 berichten · pagina 1 van 1

Sanderc

Lid · Topicstarter

Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$vraag[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"Deze moet bij antwoord 1"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$vraag[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"Deze moet bij antwoord 2"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$vraag[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #0000BB]3[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"Deze moet bij antwoord 3"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$antwoord[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"Deze moet bij vraag 1"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$antwoord[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #0000BB]2[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"Deze moet bij vraag 2"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$antwoord[/COLOR] [COLOR= #007700][[/COLOR][COLOR= #0000BB]3[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"Deze moet bij vraag 2"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #0000BB]$vragen[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/count"]count[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$vraag[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$antwoorden[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/count"]count[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$antwoord[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$random[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$vragen[/COLOR][COLOR= #007700]);[/COLOR]
?>


Wat wil ik:
Dat hij er altijd als je de pagina refresht een andere hebt,
maar als hij vraag 1 stelt, moet de gebruiker antwoord 1 invullen.
Nu heb ik wel alles goed, maar kiest hij allebei een random, dus bv bij vraag 1 kan je soms antwoord 3 ofz. invullen.

Hoe kan ik zorgen dat dus bij vraag 1 de gebruiker echt werkelijk antwoord 1 moet invullen?

Het checken enz heb ik al af en alles maar dat is niet nodig om te tonen winkAls je heel het script wilt moet je een PB sturen wink
Bedankt
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
$antwoord [array_search($random, $vraag)];

Zoiets?
0
Sanderc

Lid · Topicstarter

Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Milan schreef:
$antwoord [array_search($random, $vraag)];

Zoiets?
Ik doe het zonder array confused.
Maar het kant toch ook anders? Ik heb ooit eens een banner rotator gemaakt waar het wel werkte maar bij de code in de startpost werkt het niet en hier in wel=

[COLOR= #0000BB]<?php[/COLOR]  
[COLOR= #FF8000]//Instellingen [/COLOR]
[COLOR= #0000BB]$target[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"_blank"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//De pagina zal altijd openen in een nieuwe pagina wanneer er op geklikt wordt. [/COLOR]
[COLOR= #0000BB]$width[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"468px"[/COLOR][COLOR= #007700];[/COLOR][COLOR= #FF8000]// Breedte van de image[/COLOR]
[COLOR= #0000BB]$height[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"60px"[/COLOR][COLOR= #007700];[/COLOR][COLOR= #FF8000]// Hoogte van de image

//Linken van de image toevoegen [/COLOR]
[COLOR= #0000BB]$link[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]1[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"http://www.devshare.nl"[/COLOR][COLOR= #007700];[/COLOR]  
[COLOR= #0000BB]$link[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]2[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"http://www.one2xs.com"[/COLOR][COLOR= #007700];[/COLOR]  
[COLOR= #0000BB]$link[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]3[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"http://www.belkrediet.eu"[/COLOR][COLOR= #007700];[/COLOR]  
  
[COLOR= #FF8000]//Images toevoegen [/COLOR]
[COLOR= #0000BB]$image[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]1[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"http://devobox.3owl.com/banner2.png"[/COLOR][COLOR= #007700];[/COLOR]  
[COLOR= #0000BB]$image[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]2[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"http://www.one2xs.com/banner_o2x.png"[/COLOR][COLOR= #007700];[/COLOR]  
[COLOR= #0000BB]$image[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]3[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #DD0000]"http://belkrediet.eu/banner.png"[/COLOR][COLOR= #007700];[/COLOR]  
  
[COLOR= #FF8000]//Kijken of het aantal gelijk is[/COLOR]
[COLOR= #0000BB]$images[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$image[/COLOR][COLOR= #007700]);[/COLOR]  
[COLOR= #0000BB]$links[/COLOR]   [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$link[/COLOR][COLOR= #007700]);[/COLOR]  
[COLOR= #0000BB]$random[/COLOR]       [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$images[/COLOR][COLOR= #007700]);[/COLOR]  
  
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$images[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #0000BB]$links[/COLOR][COLOR= #007700]) {[/COLOR]  
[COLOR= #FF8000]//Als het aantal images gelijk is met het aantal links 
//Echo als de images of linken niet gelijk zijn[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Het aantal images of linken is niet gelijk."[/COLOR][COLOR= #007700]);  
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]  
[COLOR= #FF8000]// Het weergeven van verschillende banners met doorlinking.[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$link[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$random[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" target="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$target[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"><img src="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$image[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$random[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" width="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$width[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]" height="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$height[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"></a>[/COLOR][COLOR= #007700]);  
}[/COLOR]  
?>
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zodra je gebruikt maakt van [] os het een array, doe maar eens echo $vraag, dan krijg je array ( )
0
Sanderc

Lid · Topicstarter

Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Maar hoe komt dat het bij de banner rotator wel werkt terwijl het bij de vragen op dezelfde mannier gedaan is redface
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
$link[$random]." target=".$target.">
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren