Cant Submit Textarea Tinymce - php

I can't submit form textarea TinyMCE. I need to be able to use many TinyMCE's, but my code only works if I don't have any.
please help me..
this is code :
<form action="action/insert.php?table=<?= $page ?>" method="post" enctype="multipart/form-data">
<div class="form-group">
<label class="control-label" for="item">Languange</label><br/>
<label for="en"><input type="radio" name="newlang" id="en" value="en"/> English</label>
<label for="id"><input type="radio" name="newlang" id="id" value="id"/> Indonesia</label>
</div>
<div class="form-group">
<label class="control-label" for="item">Item</label>
<input type="text" name="item" id="item" value="" class="form-control" required/>
</div>
<div class="form-group">
<label class="control-label" for="code">Code</label>
<input type="text" name="code" id="code" value="" class="form-control" required/>
</div>
<div class="form-group">
<label class="control-label" for="ingred">Ingredient</label>
<textarea name="ingred" id="ingred" required></textarea>
</div>
<div class="form-group">
<label class="control-label" for="spec">Spec</label>
<textarea name="spec" id="spec" required></textarea>
</div>
<div class="form-group">
<label class="control-label" for="package">Package</label>
<textarea name="package" id="package" required></textarea>
</div>
<div class="form-group">
<label class="control-label" for="price">Price</label>
<input type="number" name="price" id="price" value="" min="0" class="form-control" required/>
</div>
<div class="form-group">
<label class="control-label" for="file">Image</label>
<input type="file" name="file" id="file" class="form-control"/>
</div>
<hr>
<div class="form-group">
<button type="submit" name="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> Add</button>
<button type="reset" name="reset" class="btn btn-default"><i class="fa fa-refresh"></i> Reset</button>
<button type="button" name="back" class="btn btn-default" onclick="location.assign('?page=<?= $page ?>/')"><i class="fa fa-reply"></i> Back</button>
</div>

I have to add a space between the textarea

How are you actually submitting the content of the editor here? Your first step would be to call editor.getcontent() somewhere.
https://www.tinymce.com/docs/api/tinymce/tinymce.editor/#getcontent

Related

Checked Radio Button Inside Echo In PHP

How i can checked radio button inside echo method ?
<?php
if(isset($_GET['sid'])){
echo'
<div class="right_col" role="main">';
$a=$_GET['sid'];
$update = $obj->selectdata($a);
foreach($update as $upd)
{
$upd['sname'];
echo'
<h1 class="text-center">update student</h1>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-8">
<form class="form-horizontal" action="dashboard.php?sid='.$upd['id'].'" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>Name</label>
<input type="text" value="'.$upd['sname'].'" name="sname" required class="form-control"/>
</div>
<div class="form-group">
<label>Father Name</label>
<input type="text" value="'.$upd['sfname'].'" name="sfname" required class="form-control"/>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" value="'.$upd['email'].'" name="semail" required class="form-control"/>
</div>
<div class="form-group">
<label>Password</label>
<input type="password" name="spass" placeholder="Change Password" required class="form-control"/>
</div>
<div class="form-group">
<label>Date Of Birth</label>
<input type="date" value="'.$upd['dob'].'" name="sdob" required class="form-control"/>
</div>
<div class="form-group">
<label>Gender</label>
<div class="radio-inline">
<label><input type="radio" name="sgender" if($s_gender == Male){echo checked=checked} value="Male" />Male</label>
</div>
<div class="radio-inline">
<label><input type="radio" name="sgender" if($s_gender == Female){echo checked=checked} value ="Female" />Female</label>
</div></div>
<div class="form-group">
<label>Contact</label>
<input type="text" name="scontact" value="'.$upd['contact'].'" required class="form-control"/>
</div>
<div class="form-group">
<label>Address</label>
<input type="text" name="saddress" value="'.$upd['address'].'" required class="form-control"/>
</div>
<div class="form-group">
<label>Photo</label>
<input type="file" name="spic" required class="form-control"/>
</div>
<button type="submit" name="upt_form" class="btn btn-default">Submit</button>
</form>
</div>
</div>';
}
}
else {
echo'
<div class="right_col" role="main">
<h1 class="text-center">add student</h1>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-8">
<form class="form-horizontal" action="dashboard.php" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>Name</label>
<input type="text" name="sname" required class="form-control"/>
</div>
<div class="form-group">
<label>Father Name</label>
<input type="text" name="sfname" required class="form-control"/>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" name="semail" required class="form-control"/>
</div>
<div class="form-group">
<label>Password</label>
<input type="password" name="spass" required class="form-control"/>
</div>
<div class="form-group">
<label>Date Of Birth</label>
<input type="date" name="sdob" required class="form-control"/>
</div>
<div class="form-group">
<label>Gender</label>
<div class="radio-inline">
<label><input type="radio" name="sgender" value="Male" required/>Male</label>
</div>
<div class="radio-inline">
<label><input type="radio" name="sgender" value ="Female"required />Female</label>
</div></div>
<div class="form-group">
<label>Contact</label>
<input type="text" name="scontact" required class="form-control"/>
</div>
<div class="form-group">
<label>Address</label>
<input type="text" name="saddress" required class="form-control"/>
</div>
<div class="form-group">
<label>Photo</label>
<input type="file" name="spic" required class="form-control"/>
</div>
<button type="submit" name="stu_form" class="btn btn-default">Submit</button>
</form>
</div>
</div>';
}
?>
Work like this:
<input type="radio" '.($s_gender == Female ? 'checked="checked"' : "").' name="sgender" value ="Female" />
<?php
if(isset($_GET['sid'])){
echo'
<div class="right_col" role="main">';
$a=$_GET['sid'];
$update = $obj->selectdata($a);
foreach($update as $upd)
{
$upd['sname'];
echo'
<h1 class="text-center">update student</h1>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-8">
<form class="form-horizontal" action="dashboard.php?sid='.$upd['id'].'" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>Name</label>
<input type="text" value="'.$upd['sname'].'" name="sname" required class="form-control"/>
</div>
<div class="form-group">
<label>Father Name</label>
<input type="text" value="'.$upd['sfname'].'" name="sfname" required class="form-control"/>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" value="'.$upd['email'].'" name="semail" required class="form-control"/>
</div>
<div class="form-group">
<label>Password</label>
<input type="password" name="spass" placeholder="Change Password" required class="form-control"/>
</div>
<div class="form-group">
<label>Date Of Birth</label>
<input type="date" value="'.$upd['dob'].'" name="sdob" required class="form-control"/>
</div>
<div class="form-group">
<label>Gender</label>
<div class="radio-inline">
if($upd['gender']== "Male") {
echo '
<label><input cheacked= "cheacked" type="radio" name="sgender" value="Male" />Male</label>
</div>';
}
else {
echo' <div class="radio-inline">
<label><input type="radio" cheacked= "cheacked" name="sgender" value ="Female" />Female</label>
</div></div>';
}
<div class="form-group">
<label>Contact</label>
<input type="text" name="scontact" value="'.$upd['contact'].'" required class="form-control"/>
</div>
<div class="form-group">
<label>Address</label>
<input type="text" name="saddress" value="'.$upd['address'].'" required class="form-control"/>
</div>
<div class="form-group">
<label>Photo</label>
<input type="file" name="spic" required class="form-control"/>
</div>
<button type="submit" name="upt_form" class="btn btn-default">Submit</button>
</form>
</div>
</div>';
}
}
else {
echo'
<div class="right_col" role="main">
<h1 class="text-center">add student</h1>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-8">
<form class="form-horizontal" action="dashboard.php" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>Name</label>
<input type="text" name="sname" required class="form-control"/>
</div>
<div class="form-group">
<label>Father Name</label>
<input type="text" name="sfname" required class="form-control"/>
</div>
<div class="form-group">
<label>Email</label>
<input type="email" name="semail" required class="form-control"/>
</div>
<div class="form-group">
<label>Password</label>
<input type="password" name="spass" required class="form-control"/>
</div>
<div class="form-group">
<label>Date Of Birth</label>
<input type="date" name="sdob" required class="form-control"/>
</div>
<div class="form-group">
<label>Gender</label>
<div class="radio-inline">
<label><input type="radio" name="sgender" value="Male" required/>Male</label>
</div>
<div class="radio-inline">
<label><input type="radio" name="sgender" value ="Female"required />Female</label>
</div></div>
<div class="form-group">
<label>Contact</label>
<input type="text" name="scontact" required class="form-control"/>
</div>
<div class="form-group">
<label>Address</label>
<input type="text" name="saddress" required class="form-control"/>
</div>
<div class="form-group">
<label>Photo</label>
<input type="file" name="spic" required class="form-control"/>
</div>
<button type="submit" name="stu_form" class="btn btn-default">Submit</button>
</form>
</div>
</div>';
}
?>
use this code then let me know if it resolved your issue, you had to put if and else with your problem in proper way you used wrong variable for get gender value.

form not sending data?

I cant for the life of me figure this out.
I have the following form which, when submitted, returns an empty array?
Its going to the right page when submitted (index.php) but its not passing anything as either GET or POST. Both return nothing using var_dump($_POST). Any ideas?
<form action="index.php" method="post">
<div class="form-group">
<label for="orderName">What is your name?</label>
<input type="textbox" class="form-control" id="orderName" aria-describedby="orderName" placeholder="Enter name">
</div>
<div class="form-group">
<label for="orderEmail">What is your email address?</label>
<input type="textbox" class="form-control" id="orderEmail" aria-describedby="orderEmail" placeholder="Enter email">
</div>
<div class="form-group">
<label for="orderCopies">How many copies of the book would you like?</label>
<input type="textbox" class="form-control" id="orderCopies" aria-describedby="orderCopies" placeholder="Enter amount of books">
<small id="oderCopiesHelp" class="form-text text-muted">Note: each book is $35 (including postage)</small>
</div>
<div class="form-group">
<label for="orderAddress">Where would you like the book/s sent to?</label>
<textarea class="form-control" id="orderAddress" rows="3"></textarea>
</div>
<div class="form-group">
<label for="orderComments">Order comments</label>
<textarea class="form-control" id="orderComments" rows="3"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Send order</button>
</form>
Input needs name attribute which is missing in your markup.
For example,
<input type="textbox" class="form-control" name="orderName" id="orderName" aria-describedby="orderName" placeholder="Enter name">
Your code with name attributes on <input>, <textarea> and <button>:
<form action="index.php" method="post">
<div class="form-group">
<label for="orderName">What is your name?</label>
<input type="textbox" class="form-control" name="orderName" id="orderName" aria-describedby="orderName" placeholder="Enter name">
</div>
<div class="form-group">
<label for="orderEmail">What is your email address?</label>
<input type="textbox" class="form-control" name="orderEmail" id="orderEmail" aria-describedby="orderEmail" placeholder="Enter email">
</div>
<div class="form-group">
<label for="orderCopies">How many copies of the book would you like?</label>
<input type="textbox" class="form-control" name="orderCopies" id="orderCopies" aria-describedby="orderCopies" placeholder="Enter amount of books">
<small id="oderCopiesHelp" class="form-text text-muted">Note: each book is $35 (including postage)</small>
</div>
<div class="form-group">
<label for="orderAddress">Where would you like the book/s sent to?</label>
<textarea class="form-control" name="orderAddress" id="orderAddress" rows="3"></textarea>
</div>
<div class="form-group">
<label for="orderComments">Order comments</label>
<textarea class="form-control" name="orderComments" id="orderComments" rows="3"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" name="submitButton">Send order</button>
</form>
You need to add name attribute tags for each input element. The name attribute and value gets sent via the post method to the script to receive it.
For each input tag always put the name attribute to pass the form data.
Ex.
<input type="textbox" class="form-control" id="orderName" name="orderName" aria-describedby="orderName" placeholder="Enter name">

How to get values of a two contact forms which is in two separate tabs in php?

I have a contact form in php which has has two tabs containing two different contact forms. I want to get all the values of both the forms and send it as an email. I have coded it for one of the tab, but i am not getting the values of each of the field in the contact form in that tab. Can anyone tell how to do this ? My code is shown below for one of the tab:
<form name="contactForm" id='contact_form' method="post" action=''>
<div tab-id="1" class="tab active">
<div class="form-inline">
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="name" id="exampleInputName" placeholder="name" >
</div>
<div class="form-group col-sm-12 padd">
<input type="email" class="form-control" name="email" id="exampleInputEmail" placeholder="email address">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="telephone" placeholder="phone">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="Country" id="exampleInputName" placeholder="Country" >
</div>
<div class="form-group col-sm-12 padd">
<textarea class="form-control" name="message" rows="3" id="exampleInputMessage" placeholder="message" ></textarea>
</div>
</div>
<div class="form-group col-xs-12 padd">
<div id='mail_success' class='success' style="display:none;">Your message has been sent successfully.
</div><!-- success message -->
<div id='mail_fail' class='error' style="display:none;"> Sorry, error occured this time sending your message.
</div><!-- error message -->
</div>
<div class="form-group col-xs-8 padd">
<div class="g-recaptcha" data-sitekey="6LcJqyITAAAAABks5hnD6U_2ptu09RiXYOHvNNud"></div>
</div>
<div class="form-group col-sm-4 padd" id='submit'>
<input type="submit" id='send_message' name="send" class="btn btn-lg costom-btn" value="send">
</div>
</div>
<div tab-id="2" class="tab">
<div class="form-inline">
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="name" id="exampleInputName" placeholder="full name" >
</div>
<div class="form-group col-sm-6 padd">
<input type="email" class="form-control" name="email" id="exampleInputEmail" placeholder="Email">
</div>
<div class="form-group col-sm-6 pad">
<input type="text" class="form-control" name="telephone" placeholder="Phone">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="subject" id="exampleInputSubject" placeholder="Tell us about your project in your own words ?" >
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="subject" id="exampleInputSubject" placeholder="Tell us about you or your company" >
</div>
<div class="form-group col-sm-12 padd">
<p>Which services are you interested in ?</p>
<p>
<input type="checkbox" id="test1" />
<label for="test1"></label>
</p>
<p>
<input type="checkbox" id="test2"/>
<label for="test2"></label>
</p>
<p>
<input type="checkbox" id="test3"/>
<label for="test3"></label>
</p>
<p>
<input type="checkbox" id="test4"/>
<label for="test4"></label>
</p>
<p>
<input type="checkbox" id="test5"/>
<label for="test5"></label>
</p>
<p>
<input type="checkbox" id="test6"/>
<label for="test6"></label>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<div id='mail_success' class='success' style="display:none;">Your message has been sent successfully.
</div><!-- success message -->
<div id='mail_fail' class='error' style="display:none;"> Sorry, error occured this time sending your message.
</div><!-- error message -->
</div>
<div class="form-group col-sm-12" id='submit'>
<input type="submit" id='send_message' class="btn btn-lg costom-btn" value="send">
</div>
</div>
</form>
Please try with this code.
<form name="contactForm" id='contact_form' method="post" action='php/email.php'>
//This is the first tab
<div tab-id="1" class="tab active">
<div class="form-inline">
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="name" id="exampleInputName" placeholder="name" >
</div>
<div class="form-group col-sm-12 padd">
<input type="email" class="form-control" name="email" id="exampleInputEmail" placeholder="email address">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="telephone" placeholder="phone">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="Country" id="exampleInputName" placeholder="Country" >
</div>
<div class="form-group col-sm-12 padd">
<textarea class="form-control" name="message" rows="3" id="exampleInputMessage" placeholder="message" ></textarea>
</div>
</div>
<div class="form-group col-xs-12 padd">
<div id='mail_success' class='success' style="display:none;">Your message has been sent successfully.
</div><!-- success message -->
<div id='mail_fail' class='error' style="display:none;"> Sorry, error occured this time sending your message.
</div><!-- error message -->
</div>
<div class="form-group col-xs-8 padd">
<div class="g-recaptcha" data-sitekey="6LcJqyITAAAAABks5hnD6U_2ptu09RiXYOHvNNud"></div>
</div>
<div class="form-group col-sm-4 padd" id='submit'>
<input type="submit" id='send_message' name="send" class="btn btn-lg costom-btn" value="send">
</div>
</div>
//This is the Second tab
<div tab-id="2" class="tab">
<div class="form-inline">
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="name" id="exampleInputName" placeholder="full name" >
</div>
<div class="form-group col-sm-6 padd">
<input type="email" class="form-control" name="email" id="exampleInputEmail" placeholder="Email">
</div>
<div class="form-group col-sm-6 pad">
<input type="text" class="form-control" name="telephone" placeholder="Phone">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="subject" id="exampleInputSubject" placeholder="Tell us about your project in your own words ?" >
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="subject" id="exampleInputSubject" placeholder="Tell us about you or your company" >
</div>
<div class="form-group col-sm-12 padd">
<p>Which services are you interested in ?</p>
<form action="#">
<p>
<input type="checkbox" id="test1" />
<label for="test1">Web Design & development</label>
</p>
<p>
<input type="checkbox" id="test2"/>
<label for="test2">E-Commerce Solutions</label>
</p>
<p>
<input type="checkbox" id="test3"/>
<label for="test3">Digital Marketing</label>
</p>
<p>
<input type="checkbox" id="test4"/>
<label for="test4">SEO Solutions</label>
</p>
<p>
<input type="checkbox" id="test5"/>
<label for="test5">2D&3D Animation</label>
</p>
<p>
<input type="checkbox" id="test6"/>
<label for="test6">Game development</label>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<div id='mail_success' class='success' style="display:none;">Your message has been sent successfully.
</div><!-- success message -->
<div id='mail_fail' class='error' style="display:none;"> Sorry, error occured this time sending your message.
</div><!-- error message -->
</div>
<div class="form-group col-sm-12" id='submit'>
<input type="submit" id='send_message' class="btn btn-lg costom-btn" value="send">
</div>
</form>
</div>
Assuming the following form-tab html structure:
<form name="contactForm" id='contact_form' method="post" action=''>
<div tab-id="1" class="tab active">
...
<input name="field1" value="" class="form-control" />
<input name="field2" value="" class="form-control" />
</div>
<div tab-id="2" class="tab">
...
<input name="field1" value="" class="form-control" />
<input name="field2" value="" class="form-control" />
</div>
</form>
As your div tabs have not attribute called id, and the class attribute you assigned is the same for every tab, it is not clear to see how to define the jquery selector for the inputs within those tabs you created.
You can access the values of each tab, using jquery as follows:
var fields = {}
fields.tab1 = {}
fields.tab1.field1 = $('div[tab-id=1] input[name=field1]').val()
fields.tab1.field2 = $('div[tab-id=1] input[name=field2]').val()
fields.tab2 = {}
fields.tab2.field1 = $('div[tab-id=2] input[name=field1]').val()
fields.tab2.field2 = $('div[tab-id=2] input[name=field2]').val()
Here is the fiddle of the working example.
var datastring = $("#contact_form").serialize();
alert(datastring);
try this in jquery after , you wiil get all the elements values between the
...
here data strings gives output as below
name=tj&email=tj#gmail.com&telephone=8888888888&Country=ind&message=msdfdf&name=tj&email=tj#gmail.com&telephone=12345689&subject=sub&subject=sub

How to Fetch Dynamic input field array items value with different name php mysql?

I have a form like below:
<form id="bookForm" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-xs-1 control-label">Book</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0].title" placeholder="Title" />
</div>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0].isbn" placeholder="ISBN" />
</div>
<div class="col-xs-2">
<input type="text" class="form-control" name="book[0].price" placeholder="Price" />
</div>
<div class="col-xs-1">
<button type="button" class="btn btn-default addButton"><i class="fa fa-plus"></i></button>
</div>
</div>
How to get value of this form in php $_Post because the name of fields are like <br/>name="book[0].title"**<br/>?
and there are many dynamic different name input fields.
If you can use for multiple books then use book[0].title like below,
<label class="col-xs-1 control-label">Book</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0][title]" placeholder="Title" />
</div>
If you want to use same form then change name of all textbox like,
<form id="bookForm" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-xs-1 control-label">Book</label>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0][title]" placeholder="Title" />
</div>
<div class="col-xs-4">
<input type="text" class="form-control" name="book[0][isbn]." placeholder="ISBN" />
</div>
<div class="col-xs-2">
<input type="text" class="form-control" name="book[0][price]" placeholder="Price" />
</div>
<div class="col-xs-1">
<button type="submit" class="btn btn-default addButton"><i class="fa fa-plus"></i></button>
</div>
</div>
And get value of this form like echo $_POST['book'][0]['title'];
I hope this can help you.
You need to change name attribute,
<div class="col-xs-4">
<input type="text" class="form-control" name="book_title" placeholder="Title" />
</div>
book[0].title, this is not valid name.
You can now get something like this,
$_POST['book_title']

HTML - form acting weird. Not redirecting to URL and using GET instead of POST

I'm a CS student and I have a DB project due in less than 24hrs! This is really annoying because I just need to forms to access my DB. Anyway, I have this form that works perfectly, while the second form does not work. Instead of posting and directing to the correct URL the second form re-loads the current page with the variables in the URL. Anybody have any ideas?
<form role="form" method="post" action="../controller/AddPerson.php">
<div class="box-body">
<div class="form-group">
<label for="newReservationFirstName"> First name</label>
<input type="text" class="form-control" name="newReservationFirstName" placeholder="Enter first name">
<label for="newReservationLastName"> Last name</label>
<input type="text" class="form-control" name="newReservationLastName" placeholder="Enter last name">
<label for="newReservationPhoneNumber"> Phone Number</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-phone"></i>
</div>
<input type="text" class="form-control" name="newReservationPhoneNum" data-inputmask='"mask": "(999) 999-9999"' data-mask/>
</div><!-- /.input group -->
<label for="newReservationStreetAddress"> Street Address</label>
<input type="text" class="form-control" name="newReservationStreetAddress" placeholder="Enter street address">
<label for="newReservationCity"> City</label>
<input type="text" class="form-control" name="newReservationCity" placeholder="Enter city">
<label for="newReservationState"> State</label>
<select class="form-control" name="newReservationState">
<?php
$result = getTableOrderBy('States','stateName');
while($row = mysql_fetch_array($result)) {
echo "<option value=".$row[stateAbbr].">".$row[stateName]."</option>";
} ?>
</select>
<label for="newReservationZip"> Zip Code</label>
<input type="text" class="form-control" name="newReservationZip" placeholder="Enter zipcode">
</div>
<button type="submit" class="btn btn-success btn-lg">Add New Customer</button>
</div>
</form>
This is the form that doesn't work correctly, both pages exist on the server:
<form role="form" method="post" action="../controller/AddEmployee.php">
<div class="box-body">
<div class="form-group">
<label for="newEmployeeFirstName"> First name</label>
<input type="text" class="form-control" name="newEmployeeFirstName" placeholder="Enter first name">
<label for="newEmployeeLastName"> Last name</label>
<input type="text" class="form-control" name="newEmployeeLastName" placeholder="Enter last name">
<label for="newEmployeePhoneNumber"> Phone Number</label>
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-phone"></i>
</div>
<input type="text" class="form-control" name="newEmployeePhoneNum" data-inputmask='"mask": "(999) 999-9999"' data-mask/>
</div><!-- /.input group -->
<label for="newEmployeeStreetAddress"> Street Address</label>
<input type="text" class="form-control" name="newEmployeeStreetAddress" placeholder="Enter street address">
<label for="newEmployeeCity"> City</label>
<input type="text" class="form-control" name="newEmployeeCity" placeholder="Enter city">
<label for="newEmployeeState"> State</label>
<select class="form-control" name="newEmployeeState">
<?php
$result = getTableOrderBy('States','stateName');
while($row = mysql_fetch_array($result)) {
echo "<option value=".$row[stateAbbr].">".$row[stateName]."</option>";
} ?>
</select>
<label for="newEmployeeZip"> Zip Code</label>
<input type="text" class="form-control" name="newEmployeeZip" placeholder="Enter zipcode">
<p></p>
<p></p>
<label for="newEmployeeFirstName"> Account Username</label>
<input type="text" class="form-control" name="newEmployeeUsername" placeholder="Enter username">
<label for="newEmployeeLastName"> Account Password</label>
<input type="text" class="form-control" name="newEmployeePassword" placeholder="Enter password">
<label for="newEmployeePhoneNumber"> Social Security Number</label>
<input type="text" class="form-control" name="newEmployeeSocial" placeholder="Enter SSN">
<div class="form-group" name="newEmployeePrivileges">
<br>
Privileges :
<select name="newEmployeePrivileges">
<option value="admin">Admin</option>
<option value="admin">Non-Admin</option>
</select>
</div>
<button type="submit" class="btn btn-success btn-lg">Add New Employee</button>
</div>
</div>
</form>
----------------------------------EDIT ----------------------------------------------
I tried making a another really simple form on some extra space and it still didn't work. I have no idea what could be cause it to do this.
<form method="post" action="post" action="../controller/AddEmployee.php">
<button type="submit" class="btn btn-success btn-lg">Add New Employee</button>
</form>
It could be that the button tag you are using to submit the form is causing it behave strangely. Try swapping out the button tag for an input. So:
<form method="post" enctype="multipart/form-data" action="../controller/AddEmployee.php">
<input type="submit" class="btn btn-success btn-lg" name="submit" >Add New Employee</input>
</form>
Also, I noticed you've included two 'action' attributes in your example form :-)

Categories