FORM-TAG not work - php

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&szlige:</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>

Related

how send in html value of php to server?

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.

PHP variable into form ($username)

<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

how to process values from a form using PHP

I'm able to display the values but my problem is to get the values from the form... This block occurs 6 times (0-41) and they have the same name so i can access/validate them using javascript. ($weeks= $_POST['wt11'];)
<input class="chgcolor" type="text" name="wt10" value="1" disabled/> /*week 1*/
<input type="text" name="wt11" id="w01" onchange="CheckCols('0')" readonly maxlength="5" value="<?php echo $dayarray[0]; ?>" />
<input type="text" name="wt11" id="w01" onchange="CheckCols('1')" readonly maxlength="5" value="<?php echo $dayarray[1]; ?>" />
<input type="text" name="wt11" id="w01" onchange="CheckCols('2')" readonly maxlength="5" value="<?php echo $dayarray[2]; ?>" />
<input type="text" name="wt11" id="w01" onchange="CheckCols('3')" readonly maxlength="5" value="<?php echo $dayarray[3]; ?>" />
<input type="text" name="wt11" id="w01" onchange="CheckCols('4')" readonly maxlength="5" value="<?php echo $dayarray[4]; ?>" />
<input type="text" name="wt11" id="w01" onchange="CheckCols('5')" readonly maxlength="5" value="<?php echo $dayarray[5]; ?>" />
<input type="text" name="wt11" id="w01" onchange="CheckCols('6')" readonly maxlength="5" value="<?php echo $dayarray[6]; ?>" />
thanks.

Codeigniter - Why creating value for input form make the whole page messed up?

I'm trying to create registration form using Codeigniter 3. This problem comes when I try to add value in each input like this:
value="<?php echo set_value('name'); ?>"
Here's my view content_register.php:
<form class="usr-input" action="/users" method="post">
<div>
<label for="name">Nama Lengkap<span style="padding-left: 90px;">:</span></label>
<input id="name" name="name" size="40" type="text" value="<?php echo set_value('name'); ?>"/>
<br>
<label for="username">Username<span style="padding-left: 124px;">:</span></label>
<input id="username" name="username" size="40" type="text" value="<?php echo set_value('username'); ?>"/>
<br>
<label for="password">Password<span style="padding-left: 125px;">:</span></label>
<input id="password" name="password" size="40" type="password" value="<?php echo set_value('password'); ?>"/>
<br>
<label for="email">Email<span style="padding-left: 155px;">:</span></label>
<input id="email" name="email" size="40" type="text" value="<?php echo set_value('email'); ?>"/>
<br>
<label for="telepon">No. Telepon<span style="padding-left: 111px;">:</span></label>
<input id="telepon" name="telepon" size="40" type="text" value="<?php echo set_value('phone'); ?>"/>
<br>
<label for="sex">Jenis Kelamin<span style="padding-left: 96px;">:</span></label>
<select>
<option value="male">Laki-laki</option>
<option value="female">Perempuan</option>
</select>
<br>
<label for="alamat">Alamat<span style="padding-left: 146px;">:</span></label>
<textarea id="alamat" name="alamat" rows="5" cols="71" type="text" value="<?php echo set_value('name'); ?>"/></textarea>
<br>
<input type="checkbox" name="vehicle" value="Bike"> Saya telah membaca dan menerima Syarat dan Peraturan dari .</input>
</div>
</form>
And the whole page messed up. It becomes like this:
Before I add value (which the code like this:)
<form class="usr-input" action="/users" method="post">
<div>
<label for="name">Nama Lengkap<span style="padding-left: 90px;">:</span></label>
<input id="name" name="name" size="40" type="text" />
<br>
<label for="username">Username<span style="padding-left: 124px;">:</span></label>
<input id="username" name="username" size="40" type="text" />
<br>
<label for="password">Password<span style="padding-left: 125px;">:</span></label>
<input id="password" name="password" size="40" type="password" />
<br>
<label for="email">Email<span style="padding-left: 155px;">:</span></label>
<input id="email" name="email" size="40" type="text" />
<br>
<label for="telepon">No. Telepon<span style="padding-left: 111px;">:</span></label>
<input id="telepon" name="telepon" size="40" type="text" />
<br>
<label for="sex">Jenis Kelamin<span style="padding-left: 96px;">:</span></label>
<select>
<option value="male">Laki-laki</option>
<option value="female">Perempuan</option>
</select>
<br>
<label for="alamat">Alamat<span style="padding-left: 146px;">:</span></label>
<textarea id="alamat" name="alamat" rows="5" cols="71" type="text" /></textarea>
<br>
<input type="checkbox" name="vehicle" value="Bike"> Saya telah membaca dan menerima Syarat dan Peraturan dari .</input>
</div>
</form>
It works well. The page should be like this:
UPDATE
Here's the controller:
<?php
class page extends CI_Controller {
function __construct() {
parent::__construct();
// path to simple_html_dom
}
function index() {
$this->load->view('page_header');
$this->load->view('content_front');
$this->load->view('page_footer');
}
function login() {
$this->load->view('page_header');
$this->load->view('content_login');
$this->load->view('page_footer');
}
function register() {
$this->load->view('page_header');
$this->load->view('content_register');
$this->load->view('page_footer');
}
}
?>
Can you help me what's wrong with this code? Or any information that I miss?
Thank you.
Change your URL into
action="/users"
to
action="<?php echo base_url()/controller/method?"
Because action="/users" is not a valid URL

$_POST returns empty on form submit in wordpress

I have a form:
<form action="<?php echo the_permalink(); ?>" method="POST">
<input type="text" name="name" value="" placeholder="Your First and Last Name *" />
<?php echo $firstnameError; ?>
<input type="text" name="email" value="" placeholder="Yoyr Email" />
<?php echo $emailError; ?>
<br>
<input type="text" name="company" value="" placeholder="Your Company Name" />
<input type="text" name="phone" value="" placeholder="Your Phone number" />
<textarea name="project" rows="4" cols="50" placeholder="Describe the scope of work and the most important features of the project *'"></textarea>
<?php echo $addressError; ?>
<br>
<input type="radio" name="budget" value="1500" />
<input type="radio" name="budget" value="2500" />
<input type="radio" name="budget" value="5000" />
<input type="radio" name="budget" value="10000" />
<input type="radio" name="budget" value="100001" />
<input type="radio" name="budget" value="not sure" />
<input type="hidden" name="submit" value="1" />
<input type="submit" value="SUbmit" />
</form>
It actions to the same page, but when I do print_r($_POST); it does not print anything, i.e. no value in $_POST.
What could be the reason(s) for this? I studied a few questions on SO on this but none gave me the answer I was looking for.
If your passing the name as a Post value, wordpress DOSNT like this!
change this
<input type="text" name="name" value="" placeholder="Your First and Last Name *" />
to
<input type="text" name="thename" value="" placeholder="Your First and Last Name *" />
changing the name to thename, Will work guaranteed! ;)
<form action="<?php the_permalink(); ?>" method="POST">
You don't need to echo the_permalink().
This works for me:
<?php print_r($_POST);?>
<form action="" method="POST">
<input type="text" name="name" value="" placeholder="Your First and Last Name *" /><?php echo $firstnameError; ?><input type="text" name="email" value="" placeholder="Yoyr Email"/><?php echo $emailError; ?><br>
<input type="text" name="company" value="" placeholder="Your Company Name"/><input type="text" name="phone" value="" placeholder="Your Phone number"/>
<textarea name="project" rows="4" cols="50"placeholder="Describe the scope of work and the most important features of the project *'"></textarea><?php echo $addressError; ?><br>
<input type="radio" name="budget" value="1500" /><input type="radio" name="budget" value="2500" /><input type="radio" name="budget" value="5000" /><input type="radio" name="budget" value="10000" /><input type="radio" name="budget" value="100001" /><input type="radio" name="budget" value="not sure" />
<input type="hidden" name="submit"value="1"/>
<input type="submit" value="SUbmit" />
</form>
change this
acton="<?php echo the_permalink(); ?>"
to
action="<?php echo the_permalink(); ?>"
I found same problem in my project and solution is in $_POST, maybe you use lower case in your code, change it to upper case.
change $_post to $_POST !
SOLUTION:
due to request problems, in wordpress sites instead of
<form action="http://example.com/">...
You may need to point the .php file.. example:
<form action="http://example.com/index.php">...
//////p.s. echo is automatically done with the_permalink() [same is: echo get_permalink()

Categories