0

Here I have form:

if(isset($_POST['Submit'])){
$username   = $_POST[username];
$email  = $_POST[email];
$domain     = $_POST[domain];
$pass   = $_POST[pass];
$package    = $_POST[package];
}

    <form action="/apiclass/code/da_create_user2.php" method="post" name="form_create_domain" id="form_create_domain">
          Nazwa domeny<input name="domain" type="text" id="domain"><br />
          User server<input name="username" type="text" id="username" value="<?php echo $user_details['username']; ?><?php echo "a02"; ?>"><br />
          Email<input name="email" type="text" id="email"  value="<?php echo $user_details['email']; ?>"><br />
          Haslo<input name="pass" type="password" id="pass"><br />
          Pakiet<input name="package" type="text" id="package"  value="newpackakge"><br />
      <p align="center">
        <input type="submit" name="Submit" value="Install shop">
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="reset" name="Submit2" value="Reset Form">
    </p>
    </form>

this form running php script in:

/apiclass/code/da_create_user2.php

example:

<input name="username" is variable in file da_create_user2.php $username

I need to set it, so that the user cannot change the text username.

I try add to form: disable or readonly also I try add .js code

document.getElementById('username').disabled = true;

When I set it up like this and try to submit the form, it gets an error as if that value was not passed to the PHP script. The script then believes that I'm sending an empty value. How to solve it?

TOM ARM
  • 51
  • 3
  • `it gets an error` means the PHP throws a notice/warning or you get a browser/console error? If the error is on the next page please include the code related to the error and the code. A `disable`d element wont send, https://stackoverflow.com/questions/22989845/how-do-i-post-disabled-input – user3783243 Jan 21 '22 at 17:25
  • Really Thanks Dear! This tip with only hidden wihout "" help me and working now! – TOM ARM Jan 21 '22 at 17:56

0 Answers0