The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form dropdown list
#11
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.
  Reply
#12
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.
  Reply
#13
That is because your selects ID is "streetlist" not "street"
  Reply
#14
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>
  Reply
#15
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!
  Reply
#16
Karsen, THANKS! Smile (and yes in caps)
This was driving me nuts.
  Reply
#17
Sorry I didn't notice that - thank you @Karsen!
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)