update database in ColdFusion - mysql

I have a ColdFusion form that I want to update my database. I am using the record ID, but there's a issue. When I type the url - localhost:8500/elephant_shack/update.cfm?record_id=1 I get to the for, but not with the form. I am a totally newbie and am lost!
Any help would be great :)
<!--- form--->
<cfquery name="GetRecordtoUpdate" datasource="elephant_shack">
SELECT *
FROM Richard
WHERE record_id = #URL.record_id#
</cfquery>
<table>
<cfoutput query= "GetRecordtoUpdate">
<form action="update_action.cfm" method="Post">
<tr>
<td width="93">record id:</td>
<td width="286"><input name="record_id" type="text" value="#record_id#" size="25"></td>
</tr>
<tr>
<td width="93">Item:</td>
<td width="286"><input name="item" type="text" value="#item#" size="25"></td>
</tr>
<tr>
<td>Stock:</td>
<td><input name="stock" type="text" value="#stock#" size="12"></td>
</tr>
<tr>
<td>Par:</td>
<td><input name="par" type="text" value="#par#" size="12"></td>
</tr>
<tr>
<td>Order:</td>
<td><input name="order" type="text" value="#order#" size="50"></td>
</tr>
<tr>
<td> </td>
<td><input type="Submit" value="Update Information"></td>
</tr>
</form>
</cfoutput>
</table>
Also, the database is not being updated.
<!--- update form--->
<cfupdate datasource="elephant_shack" tablename="Richard">

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>

How to Insert multiple Records from HTML Table Rows

The following HTML Code displays input fields for Single Record and provides for saving this Single Record to the Database
<html>
<body>
<form method="post" action="demo_add.asp">
<table>
<tr>
<td>CustomerID:</td>
<td><input name="custid"></td>
</tr><tr>
<td>Company Name:</td>
<td><input name="compname"></td>
</tr><tr>
<td>Contact Name:</td>
<td><input name="contname"></td>
</tr><tr>
<td>Address:</td>
<td><input name="address"></td>
</tr><tr>
<td>City:</td>
<td><input name="city"></td>
</tr><tr>
<td>Postal Code:</td>
<td><input name="postcode"></td>
</tr><tr>
<td>Country:</td>
<td><input name="country"></td>
</tr>
</table>
<br>
<input type="submit" value="Add New">
<input type="reset" value="Cancel">
</form>
</body>
</html>
How is possible to save multiple such records in One Operation?

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

How can I fix this html table

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>

Using HTML::Template within a value attribute

my question is how would I use an HTML::Template tag inside a value of form field to change that field. For example
<table border="0" cellpadding="8" cellspacing="1">
<tr>
<td align="right">File:</td>
<td>
<input type="file" name="upload" value= style="width:400px">
</td>
</tr>
<tr>
<td align="right">File Name:</td>
<td>
<input type="text" name="filename" style="width:400px" value="" >
</td>
</tr>
<tr>
<td align="right">Title:</td>
<td>
<input type="text" name="title" style="width:400px" value="" />
</td>
</tr>
<tr>
<td align="right">Date:</td>
<td>
<input type="text" name="date" style="width:400px" value="" />
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="button" value="Cancel">
<input type="submit" name="action" value="Upload" />
</td>
</tr>
</table>
I want the value to have a <TMPL_VAR> variable in it.
You use it the same way you'd use a template variable anywhere else:
<input type="text" name="date" style="width:400px" value="<TMPL_VAR NAME=date>" />
Yeah, it's ugly and it breaks your HTML validator. Which is one of the many reasons why I like Template Toolkit better.