How can I fix this html table - html

I think My html code is messed up and I can't fix it.I he been workin on for 2 hours
this is the output
Please can you help me
<?php
if($_POST){
}
else{
echo '
<form action="" method="post">
<table cellspacing="5" cellpadding="5">
<tr>
<td>Ad</td>
<td><input type="text" name="ad"></td>
</tr>
<tr>
<td>Posta</td>
<td><input type="text" name="posta"></td>
</tr>
<tr>
<td>Mesaj</td>
<td><textarea rows="5" cols="30" name="mesaj"</textarea>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Gonder"></td>
</tr>
</table>
</form>
';
}
?>

<form action="" method="post">
<table cellspacing="5" cellpadding="5">
<tr>
<td>Ad</td>
<td>
<input type="text" name="ad">
</td>
</tr>
<tr>
<td>Posta</td>
<td>
<input type="text" name="posta">
</td>
</tr>
<tr>
<td>Mesaj</td>
<td>
<textarea rows="5" cols="30" name="mesaj"> </textarea>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" value="Gonder">
</td>
</tr>
</table>
</form>
You forgot to close the textarea tag and the td its in, also please use some indentation. it hurts my eyes!

<textarea> Missing '>' For End Of Tag (At line 13, column 9)
it should be
<form action="" method="post">
<table cellspacing="5" cellpadding="5">
<tr>
<td>Ad</td>
<td><input type="text" name="ad"></td>
</tr>
<tr>
<td>Posta</td>
<td><input type="text" name="posta"></td>
</tr>
<tr>
<td>Mesaj</td>
<td><textarea rows="5" cols="30" name="mesaj"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Gonder"></td>
</tr>
</table>
</form>

Related

How can I make my table to move in the side of the first table?

This is my table and I want to put the second table beside the first table but when I tried it nothing happen and also how can I make my table in the same width as the second table I tried to add width, but the table cannot sync together
enter image description here
and this is my code
<table border="1" bordercolor="#336699" align="center">
<!-- TABLE -->
<tr>
<td><b>LAST NAME:<b></td>
<td><input type="text" name="lname"></td>
</tr>
<tr>
<td><b>FIRST NAME:</b></td>
<td><input type="text" name="fname"></td>
</tr>
<tr>
<td><b>MIDDLE NAME:<b></td>
<td><input type="text" name="mname"></td>
</tr>
<tr>
<td><b>COURSE:</b></td>
<td>
<select name="course">
<option value="BSCS">BSCS</option>
<option value="BSIT">BSIT</option>
<option value="BSCE">BSCE</option>
<option value="BSEMC">BSEMC</option>
</select>
</tr>
</div>
</div>
<!-- TABLE 2 -->
<table border="1" bordercolor="#336699" align="center">
<tr>
<td><b>SEX:</b></td>
<td>
<select name="gender">
<option value="FEMALE">FEMALE</option>
<option value="MALE">MALE</option>
</select>
<tr>
<td><b>AGE:<b></td>
<td><input type="text" name="age"></td>
</tr>
<tr>
<td><b>CONTACT NUMBER:<b></td>
<td><input type="text" name="cp"></td>
</tr>
</tr>
<tr>
<td><label for="birthday"><b>BIRTHDAY:</b></label>
</td>
<td><input type="date" name="birthday"></td>
</tr>
<tr>
<td><b>FATHER NAME:<b></td>
<td><input type="text" name="ffname"></td>
</tr>
<tr>
<td><b>MOTHER NAME:<b></td>
<td><input type="text" name="mmname"></td>
</tr>
<tr>
<td><b>GUARDIAN NAME:<b></td>
<td><input type="text" name="mmname"></td>
</tr>
<tr>
<td><b>ADDRESS:<b></td>
<td><textarea name="w3review" rows="3" cols="15">
</textarea>
</td>
</tr>
<tr>
<td colspan="2"><center><input type="submit" value="Save">
<input type="reset" value="clear"></center>
</td>
</tr>
You had a wrong HTML structure.
To put them the way you wanted you need to wrap the two tables with a div. I call it a container. And set a CSS rule "display: flex"
.container {
display: flex
}
<div class="container">
<table border="1" bordercolor="#336699" align="center">
<tr>
<td><b>LAST NAME:</b></td>
<td><input type="text" name="lname" /></td>
</tr>
<tr>
<td><b>FIRST NAME:</b></td>
<td><input type="text" name="fname" /></td>
</tr>
<tr>
<td><b>MIDDLE NAME:</b></td>
<td><input type="text" name="mname" /></td>
</tr>
<tr>
<td><b>COURSE:</b></td>
<td>
<select name="course">
<option value="BSCS">BSCS</option>
<option value="BSIT">BSIT</option>
<option value="BSCE">BSCE</option>
<option value="BSEMC">BSEMC</option>
</select>
</td>
</tr>
</table>
<!-- TABLE 2 -->
<table bordercolor="#336699" align="center">
<tr>
<td><b>SEX:</b></td>
<td>
<select name="gender">
<option value="FEMALE">FEMALE</option>
<option value="MALE">MALE</option>
</select>
</td>
</tr>
<tr>
<td><b>AGE:</b></td>
<td><input type="text" name="age" /></td>
</tr>
<tr>
<td><b>CONTACT NUMBER:</b></td>
<td><input type="text" name="cp" /></td>
</tr>
<tr>
<td>
<label for="birthday"><b>BIRTHDAY:</b></label>
</td>
<td><input type="date" name="birthday" /></td>
</tr>
<tr>
<td><b>FATHER NAME:</b></td>
<td><input type="text" name="ffname" /></td>
</tr>
<tr>
<td><b>MOTHER NAME:</b></td>
<td><input type="text" name="mmname" /></td>
</tr>
<tr>
<td><b>GUARDIAN NAME:</b></td>
<td><input type="text" name="mmname" /></td>
</tr>
<tr>
<td><b>ADDRESS:</b></td>
<td><textarea name="w3review" rows="3" cols="15"> </textarea></td>
</tr>
<tr>
<td colspan="2">
<center><input type="submit" value="Save" /> <input type="reset" value="clear" /></center>
</td>
</tr>
</table>
</div>

HTML- Form -<textarea> is breaking the alignment in the table layout

In HTML I am making a form where there are 2 tables side by side. In one table all the form <label>/Name/E Mail/Password</label> and in another table I am trying to put the form <inputs> text/email/password to make them look nicely visible.
But when I gave the label Message and <textarea name="Message" rows="1" cols="30"></text area> my whole form layout is getting disturbed due to which I am not able keep my initial labels and inputs aligned.
<form class="" action="index.html" method="post">
<table>
<tr>
<td>
<table>
<tr>
<td>
<label>Name</label>
</td>
</tr>
<tr>
<td>
<label>Email</label>
</td>
</tr>
<tr>
<td>
<label>Password</label>
</td>
</tr>
<tr>
<td>
<label>Message</label>
</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td>
<input type="text" name="" value="">
</td>
</tr>
<tr>
<td>
<input type="email" name="" value="">
</td>
</tr>
<tr>
<td>
<input type="password" name="" value="">
</td>
</tr>
<tr>
<td>
<textarea name="Message" rows="1" cols="30"></textarea>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
When the labels and inputs are aligned
When the labels and inputs are not aligned
There is no need for the extra table inside of the table, and you are including everything inside of 1 row, which is why its formatted like that.
You shouldn't be using tables for this, not when you have things like CSS Flexbox and CSS Grid. Here is a basic example of using flexbox with a form.
But if you must use a table, try a table format like this ...
<table>
<tr>
<td>label here</td>
<td>form field here</td>
</tr>
<tr>
<td>label here</td>
<td>form field here</td>
</tr>
...
</table>
Here is an example using your code.
<form class="" action="index.html" method="post">
<table>
<tr>
<td>
<label>Name</label>
</td>
<td>
<input type="text" name="" value="">
</td>
</tr>
<tr>
<td>
<label>Email</label>
</td>
<td>
<input type="email" name="" value="">
</td>
</tr>
<tr>
<td>
<label>Password</label>
</td>
<td>
<input type="password" name="" value="">
</td>
</tr>
<tr>
<td>
<label>Message</label>
</td>
<td>
<textarea name="Message" rows="1" cols="30"></textarea>
</td>
</tr>
</table>
</form>

Submit button not posting email [duplicate]

This question already has answers here:
HTML form email using mailto in form action doesnt work in Internet Explorer
(3 answers)
Closed 4 years ago.
I made a simple form to meet the needs on my website. It was as wanted, however, I am not able to use the "mailto" function to send the information provided by the user to my email.
After pressing the "send" button, no action is taken. can anybody help me?
NOTE: The form is HTML-only, no database usage, it's just an e-mail bridge.
<div class ="Formulario">
<div align="center">
<form id="form1" name="formulario" method="post" action="mailto:helpcelere#gmail.com">
<table width="200" height="250" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><input name="txt_nome" type="text" form="form1" placeholder="Nome" /></td>
</tr>
<tr>
<td><input name="txt_titulo" type="text" id="txt_titulo" form="form1" placeholder="Título do problema" titulo="txt_titulo" /></td>
</tr>
<tr>
<td><input name="txt_email" type="text" id="txt_email" form="form1" placeholder="Seu e-mail" email="txt_email" /></td>
</tr>
<tr>
<td><textarea cols="50" rows="8" form="form1" placeholder="Mensagem"></textarea></td>
</tr>
<tr>
<td><input type="submit" form="form1" formaction="mailto:helpcelere#gmail.com" formmethod="POST" value="enviar" /></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
try this instead
<div class ="Formulario">
<div align="center">
<form id="form1" name="formulario" method="post" action="mailto:helpcelere#gmail.com">
<table width="200" height="250" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><input name="txt_nome" type="text" form="form1" placeholder="Nome" /></td>
</tr>
<tr>
<td><input name="txt_titulo" type="text" id="txt_titulo" form="form1" placeholder="Título do problema" titulo="txt_titulo" /></td>
</tr>
<tr>
<td><input name="txt_email" type="text" id="txt_email" form="form1" placeholder="Seu e-mail" email="txt_email" /></td>
</tr>
<tr>
<td><textarea cols="50" rows="8" form="form1" placeholder="Mensagem"></textarea></td>
</tr>
<tr>
<td><input type="submit" value="enviar" /></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>

Except Line Break in Input Text Fieldset

i have the following html to Capture some Data.
<fieldset>
<legend>Rezept hinzufügen</legend>
<form action="php_act/create.php" method="post">
<table cellspacing="0" cellpadding="0">
<tr>
<th>Rezept Name</th>
<td><input type="text" name="name" placeholder="Rezept Name" /></td>
</tr>
<tr>
<th>Kurzbeschreibung</th>
<td><input type="text" name="kurztext" placeholder="Kurzbeschreibung" class="kurztext" /></td>
</tr>
<tr>
<th>Kategorie</th>
<td><input type="text" name="Kategorie" placeholder="Kategorien - mit , trennen" /></td>
</tr>
<tr>
<th>Anforderung</th>
<td><select name="Anforderung">
<option value="einfach">einfach</option>
<option value="mittel">mittel</option>
<option value="schwer">schwer</option>
</select></td>
</tr>
<tr>
<th>Zeit / Nährwerte</th>
<td><input type="text" name="zeit" placeholder="Zeit in minuten" /></td>
<td><input type="text" name="KCAL" placeholder="KCAL" size="6"/></td>
<td><input type="text" name="KH" placeholder="KH" size="6"/></td>
<td><input type="text" name="Eiweiss" placeholder="Eiweiss" size="6"/></td>
<td><input type="text" name="Fett" placeholder="Fett" size="6" /></td>
</tr>
<tr>
<th>Portionen</th>
<td><input type="text" name="Portionen" placeholder="Portionen" /></td>
</tr>
<tr>
<th>Zutaten</th>
<td><input type="text" name="zutaten" placeholder="Zutaten" /></td>
</tr>
<tr>
<th>Zubereitung</th>
<td><input type="text" name="zubereitung" placeholder="Zubereitung" /></td>
</tr>
<tr>
<th>FotoliaID</th>
<td><input type="text" name="FotoliaID" placeholder="FotoliaID" /></td>
</tr>
<tr>
<td><button type="submit">Speichern</button></td>
<td><button type="button">zurück</button></td>
</tr>
</table>
</form>
</fieldset>
There are some Input Type Text. i need to capture line breaks within the textfields. Problem is that "Enter" submits by default the. Is it possible to change that. Enter should add a line break in the textfield and not submit the form.
Can't you use textarea instead of textbox?
In a textarea you can insert enters.
https://www.w3schools.com/tags/tag_textarea.asp

HTML tables not displaying consistently

<table cellspacing="0" cellpadding="0">
<textarea rows="5" cols="60" name="question"></textarea>
<tr>
<td><input type="text" readonly="1" value="127.0.0.1" /></td>
<td><input type="submit" value="Skicka" /></td>
</tr>
</table>
equals to
How can I do so that the submit button stays where I want it (look pic). If I mess with width of the table it gets completely different in Firefox and IE.
Put the <textarea> in a table cell:
<table cellspacing="0" cellpadding="0">
<tr><td colspan="2">
<textarea rows="5" cols="60" name="question"></textarea>
</td><tr>
<td><input type="text" readonly="1" value="127.0.0.1" /></td>
<td><input type="submit" value="Skicka" /></td>
</tr>
</table>
Create your table like this:
<table cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<textarea rows="5" cols="60" name="question"></textarea>
</td>
</tr>
<tr>
<td><input type="text" readonly="1" value="127.0.0.1" /></td>
<td align="right"><input type="submit" value="Skicka" /></td>
</tr>
</table>
Note the colspan="2" and the align="right" attributes on the first and last td element.
Also I moved the textarea into a td as well.
Your textarea is not in a cell. It's between rows, no wonder it's messed up :)
Try:
<table cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><textarea rows="5" cols="60" name="question"></textarea>
</tr>
<tr>
<td><input type="text" readonly="1" value="127.0.0.1" /></td>
<td><input type="submit" value="Skicka" /></td>
</tr>
</table>
You'll want to put that textarea into a table cell with colspan="2" to get the desired effect.
Bonus points if you use CSS instead of a table for this ;)
Your textarea needs to be in a table row as well. Not tested, but try this:
<table cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<textarea rows="5" cols="60" name="question"></textarea>
</td>
</tr>
<tr>
<td>
<input type="text" readonly="1" value="127.0.0.1" />
</td>
<td>
<input type="submit" value="Skicka" />
</td>
</tr>
</table>
I'm not sure, but first try putting the textarea in a cell, like this:
<tr>
<td colspan="2">
<textarea>Stuff</textarea>
</td>
</tr>