I am working on a form and Have the following html:
<div class="colright">
<h3>Choose # of Words </h3>
<P>Pick 1, 2, 3, or 4. More words means more security.</P>
<form action="logic.php" method="post">
<label for="length">How Many? </label>
<select name="length" id="length">
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
</select>
<div class="form-group checkbox">
<label><br/>
<input type="checkbox" name="numbers"> Add numbers?
</label>
<label><br/>
<input type="checkbox" name="symbols"> Add symbols?
</label><br />
<!--<label>Choose a Theme: </label><br />
<input type="radio" name="city" value="city" checked>Cities
<input type="radio" name="car" value="car">Cars
<input type="radio" name="flower" value="flower">Flowers -->
<hr>
<p><input type="submit"></p>
</div>
</form>
</div>
with the php as follows:
[php]<?php
/* define var and get form data */
$length = $_POST[‘length’];
$numbers = $_POST[‘numbers’];
$symbols = $_POST[‘symbols’];
$pw = array ();
$newPw = array ();
$words = array (“pizza”, “lasagna”, “pasta”, “gelato”);
$ranWords = array_rand($words, 4);
/* generate words for pw generation */
$ranWords;
switch($length){
case $length = 2:
array_push($pw[$ranWords(0,1)]);
break;
case $length = 3:
array_push($pw[$ranWords(0,1,2)]);
break;
case $length = 4:
array_push($pw[$ranWords(0,1, 2,3)]);
break;
}
/* generate some random numbers and symbols */
$someSym = array("!", “@”, “#”, “%”, “&”);
$somenum = array (“1”, “2”, “3”, “4”);
$ranNum = array_rand($somenum, 1);
$ranSym = array_rand($someSym, 1);
If ($numbers = true || $symbols = true){
array_push($pw, $ranNum, $ranSym);
}elseif ($numbers != true || $symbols = true) {
array_push($pw, $ranSym);
}elseif ($numbers = true || $symbols != true) {
array_push($pw, $ranNum);
}else {
$pw = $pw;
}
[/php]
I am getting errors on lines 4, 5, 6 and 19. Not sure why my var’s are not correct.
Appreciate any thoughts…