I try send value of input to the server, but in server I receive NULL of variable front side:
<form method="POST" action="validationUploadEmployee.php" style="border:1px solid #ccc">
<div class="container">
<input type="number" placeholder="Enter ID" name="idW" value = '<?php echo "$idW"; ?>' disabled="disabled" required >
<input type="text" placeholder="Enter Full Name" name="name" value = '<?php echo "$nameE"; ?>' required>
<input type="email" placeholder="Enter Email" name="email" value='<?php echo "$emailE"; ?>
<input type="text" placeholder="Enter Password" name="psw" value='<?php echo "$passwordE"; ?>' maxlength="10" size="8" required>
<input type="text" placeholder="Repeat Password" name="psw-rpt" value='<?php echo "$passwordE"; ?>' maxlength="10" size="8" required>
<input type="number" placeholder="Enter Number Phone" name="phone" value='<?php echo "$phoneE"; ?>' required>
<input type="text" placeholder="" name="branch" value='<?php echo "$myBranch"; ?>' disabled="disabled" required>
server side I receive variable like that:
$idW=$_POST['idW'];//id worker
Thank you.
Related
I have a standard form with all user info, I want to have a drop down list where the state input is so the user can select the state. I have a database with state code and description. Here's the code for my form, just need to know how to add the drop down list so it will show up where the state code is. I've tried putting the drop down using the regular drop down code but when I do that the drop down list shows up at the top of the form.
<section class="main-container">
<div class="main-warpper">
<h2>Sign up</h2>
<form class="signup-form" action="includes/signupinc.php" method="POST">
<input type="text" name="mbrnumber" placeholder="Member Number">
<input type="text" name="alias" placeholder="Alias">
<input type="text" name="firstname" placeholder="First Name">
<input type="text" name="lastname" placeholder="Last Name">
<input type="text" name="address" placeholder="Address">
<input type="text" name="city" placeholder="City">
<input type="text" name="state" placeholder="State">
<input type="text" name="zipcode" placeholder="Zip Code">
<input type="text" name="email" placeholder="E-mail">
<input type="password" name="pwd" placeholder="Password">
<button = type="submit" name="submit">Sign Up</button>
</form>
</div>
</section>
I've been playing around with this and have come up with something like I want. I would like the state code drop down list to look like the placeholder in the rest of the form. Width height I know I can style this but not sure just how to do that. Here's the code I have come up with. The state drop down list comes from my database.
<section class="main-container">
<div class="main-warpper">
<h2>Sign up</h2>
<form class="signup-form" action="includes/signup.inc.php" method="POST">
<input type="text" name="clubname" placeholder="Your databae name(lower case only no spaces)">
<input type="text" name="mbrnumber" placeholder="Member Number">
<input type="text" name="alias" placeholder="Alias">
<input type="text" name="firstname" placeholder="First Name">
<input type="text" name="lastname" placeholder="Last Name">
<input type="text" name="address" placeholder="Address">
<input type="text" name="city" placeholder="City">
<tr>
<input type="text" name="state" placeholder="State">
<select name="state">
<?php
$sql="Select * from matchstates";
echo "<option value='' selected>Select State</option>";
foreach ($conn->query($sql) as $row) {
echo "<option value=$row[statecode]>$row[statename]</option>";
}
?>
</select>
</tr>
<input type="text" name="zipcode" placeholder="Zip Code">
<input type="text" name="email" placeholder="E-mail">
<input type="password" name="pwd" placeholder="Password">
<button = type="submit" name="submit">Sign Up</button>
</form>
</div>
<form method="POST">
<h1>Enquiries</h1>
<span><h2 class="required">*Required</h2></span>
<div class="input-group">
<label class="sr-only">Firstname</label>
<input class="text" type="text" name="name" value="<?php print_r($username)?>" />
</div>
<label class="sr-only">Lastname</label>
<input class="text" type="text" name="Lastname" placeholder="*" required>
<label class="sr-only">Email</label>
<input class="text" type="text" name="email" placeholder="">
<label class="sr-only">Subject</label>
<input type="text" name="password" class="text" placeholder="*">
<label for="inputPassword" class="sr-only">Comment:</label>
<textarea id="text" placeholder="Write something..." required> </textarea>
<input type="submit" action="submit.php">
I need to input my $username into the firstname input field. How can I set the automatic value to be $username When a logged in user goes to send an enquiry.
<input class="text" type="text" name="name" value="<?php echo isset($username) ? $username : '' ?>" />
You need to use echo instead of print_r. Also check if the variable exists.
<input class="text" type="text" name="name" value="<?php echo !empty($username) ? $username : ''; ?>" />
Just try this
<input class="text" type="text" name="name" value="<?= $username ?>" />
Will fix it if the variable username has been initialized prior
i try to send this form-tag to my page customer.php but it doesn´t send a post to customer.php
in customer.php $_POST is always NULL
<form action="customer.php" method="POST">
<span id="MyCustomerDataHeader">MEINE KONTAKTDATEN</span><br><br><br>
<label class="MyCustomerDataLabel">Nachname:</label><input type="text" name="secondname" class="MyCustomerData" value="<?php print_r($query->getCustomerData()->secondname);?>"/><br>
<label class="MyCustomerDataLabel">Vorname:</label><input type="text" name="firstname" style="margin-left:15px;" class="MyCustomerData" value="<?php echo $query->getCustomerData()->firstname;?>"/><br>
<label class="MyCustomerDataLabel">E-mail:</label><input type="text" name="email" style="margin-left:30px;" class="MyCustomerData" value="<?php echo $query->getCustomerData()->email;?>" /><br>
<label class="MyCustomerDataLabel">Geburtstag:</label><input type="birthday" name="birthday" style="margin-left:-10px;" class="MyCustomerData" value="<?php echo $query->getCustomerData()->birthday;?>" /><br>
<label class="MyCustomerDataLabel">Handynummer:</label><input type="text" name="mobilephone" style="margin-left:-40px;" class="MyCustomerData" value="<?php echo $query->getCustomerData()->mobilephone;?>" /><br>
<label class="MyCustomerDataLabel">Straße:</label><input type="text" name="street" style="margin-left:15px;" class="MyCustomerData" value="<?php echo $query->getCustomerData()->street;?>" /><br>
<label class="MyCustomerDataLabel">Stadt:</label><input type="text" name="city" style="margin-left:30px;" class="MyCustomerData" value="<?php echo $query->getCustomerData()->city;?>" /><br>
<label class="MyCustomerDataLabel">Bundesland:</label><input type="text" name="federalestate" style="margin-left:-25px;" class="MyCustomerData" value="<?php echo $query->getCustomerData()->federalestate;?>"/><br>
<label class="MyCustomerDataLabel">Land:</label><input type="text" name="country" style="margin-left:30px;" class="MyCustomerData" value="<?php echo $query->getCustomerData()->country;?>"/><br>
<input type="submit" id="myCustomerDataButton" name="deleCustomer" style="font-size:14pt;margin-top:-5px;" value="ACCOUNT LÖSCHEN" />
</form>
I have session variables that are posted from a form on another php page, and I can echo them by using:
<?php $_SESSION['newsletterSignup'] = $_POST['newsletterSignup'];
echo "Email = ". $_SESSION['newsletterSignup'];
?>
But I can't seem to insert these into a HTML form field:
<input type="text" name="email" id="email" size="36" "value="<?php echo $_SESSION['newsletterSignup'];?>" class="text-input" onBlur="emailval()" />
This should work...the quote before value was probably screwing it up
<input type="text" name="email" id="email" size="36" value="<?php echo $_SESSION['newsletterSignup'];?>" class="text-input" onBlur="emailval()" />
you use
<input type="text" name="email" id="email" size="36" "value="<?php echo $_SESSION['newsletterSignup'];?>" class="text-input" onBlur="emailval()" />
A " to many. Here is the fix
<input type="text" name="email" id="email" size="36" value="<?php echo $_SESSION['newsletterSignup'];?>" class="text-input" onBlur="emailval()" />
Also, did you use session_start(); ?
I want to get value from php variable to review it in textbox
what I have to write in "value":
<input type="text" name="name3" size="25" maxlength="50" value=""> name:
<input type="text"
name="name3"
size="25"
maxlength="50"
value="<?php echo htmlspecialchars($variable); ?>">
<input type="text" name="name3" size="25" maxlength="50" value="<?php echo $variable; ?>">