The following warnings occurred: | ||||||||||||||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Form dropdown list - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23) +--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26) +--- Thread: Form dropdown list (/showthread.php?tid=702) Pages:
1
2
|
Form dropdown list - pierre - 09-01-2017 Correct, all the fields I created in the form I also created in join.php at all the required sections. When I switch from <select class="form-control" name="streetlist" form="payment-form" required> <option value="choose">Click To Choose Your Street Name</option> <option value="Bloukeur">Bloukeur</option> to <input type="text" class="form-control" id="street" name="street" placeholder="Street Name e.g. Douglas Carr" value="<?php if (!$form_valid && !empty($_POST)){ echo $street;} ?>" required> it works. Therefor something in the <select> is causing the form to think a street has not been chosen, even though it clearly has. I just can't figure out what is causing this behavior. Form dropdown list - pierre - 09-01-2017 OK, thought I spotted what you were referring to. In join.php I now added the fields: if(Input::exists()){ $username = Input::get('username'); $fname = Input::get('fname'); $lname = Input::get('lname'); $email = Input::get('email'); $house_nr = Input::get('house_nr'); $street = Input::get('street'); $phone_h = Input::get('phone_h'); $phone_m = Input::get('phone_m'); $agreement_checkbox = Input::get('agreement_checkbox'); I already had this in: // echo "Trying to create user"; $user->create(array( 'username' => Input::get('username'), 'fname' => Input::get('fname'), 'lname' => Input::get('lname'), 'email' => Input::get('email'), 'house_nr' => Input::get('house_nr'), 'street' => Input::get('street'), 'phone_h' => Input::get('phone_h'), 'phone_m' => Input::get('phone_m'), 'password' => password_hash(Input::get('password'), PASSWORD_BCRYPT, array('cost' => 12)), 'permissions' => 1, 'account_owner' => 1, 'stripe_cust_id' => '', 'join_date' => $join_date, 'company' => Input::get('company'), 'email_verified' => $pre, 'active' => 1, 'vericode' => $vericode, )); } catch (Exception $e) { die($e->getMessage()); I switched back to the <select> code. Still get the same error "Street is required" though. Form dropdown list - Brandin - 09-01-2017 That is because your selects ID is "streetlist" not "street" Form dropdown list - pierre - 09-01-2017 Thanks Brandin, still fails though. <label for="street">Type Your Street Name*</label> <!-- <input type="text" id="street" name="street" list="street" class="form-control" placeholder="Street Name e.g. Douglas Carr" required> --> <select id="street" class="form-control" form="payment-form" required> <option value="">Choose</option> <option value="Bloukeur">Bloukeur</option> <option value="Douglas Carr">Douglas Carr</option> <option value="Kershout">Kershout</option> </select> Form dropdown list - karsen - 09-01-2017 You gave your select element an id, but not a name. Code: <select id="street" name="street" class="form-control" form="payment-form" required> The id is a unique name for the an element and is usually used for Javascript manipulation, while the name should be unique to each form is what is passed to your POST data to be used via PHP. I often make this mistake myself when changing forms around so it's something I'm always looking out for! Form dropdown list - pierre - 09-01-2017 Karsen, THANKS! (and yes in caps) This was driving me nuts. Form dropdown list - Brandin - 09-01-2017 Sorry I didn't notice that - thank you @Karsen! |