Jump to content

help with proberly simple error


winmastergames

Recommended Posts

Well i didnt know if i should put this in PHP help or html but it has PHP in it so here we go

form code:

<form action="neworderwebsite.php" method="post"><input type="submit" value="Order Now!"><input name="orderdata" type="hidden" value='<form action="neworderwebsite.php" method="post">    Website Order Number: <?php echo $_POST["websiteechonumber"]; ?><br>    Available Work Time: <?php echo $_POST["echotimeava"]; ?><br>    First Name:<input type="text" name="firstname"><br>    Last Name:<input type="text" name="lastname"><br>    Email:<input type="text" name="youremail"><br>    <input type="submit" value="Submit"></form><br>    Please Use a valid Name and email so we can contact you to make your website'><input type="hidden" name="websiteechonumber" value="1"><input type="hidden" name="echotimeava" value="5"></form>

neworderwebsite.php:

<? include("config.php"); ?>

<HTML>
<HEAD>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="language" content="en-us" />
<title><?php echo $websitename ?></title>
<script type="text/javascript">
<!--
/* http://www.alistapart.com/articles/zebratables/ */
function removeClassName (elem, className) {
elem.className = elem.className.replace(className, "").trim();
}

function addCSSClass (elem, className) {
removeClassName (elem, className);
elem.className = (elem.className + " " + className).trim();
}

String.prototype.trim = function() {
return this.replace( /^\s+|\s+$/, "" );
}

function stripedTable() {
if (document.getElementById && document.getElementsByTagName) {  
	var allTables = document.getElementsByTagName('table');
	if (!allTables) { return; }

	for (var i = 0; i < allTables.length; i++) {
		if (allTables[i].className.match(/[\w\s ]*scrollTable[\w\s ]*/)) {
			var trs = allTables[i].getElementsByTagName("tr");
			for (var j = 0; j < trs.length; j++) {
				removeClassName(trs[j], 'alternateRow');
				addCSSClass(trs[j], 'normalRow');
			}
			for (var k = 0; k < trs.length; k += 2) {
				removeClassName(trs[k], 'normalRow');
				addCSSClass(trs[k], 'alternateRow');
			}
		}
	}
}
}

/* onload state is fired, append onclick action to the table's DIV */
/* container. This allows the HTML document to validate correctly. */
/* addIEonScroll added on 2005-01-28                               */
/* Terence Ordona, portal[AT]imaputz[DOT]com                       */
function addIEonScroll() {
var thisContainer = document.getElementById('tableContainer');
if (!thisContainer) { return; }

var onClickAction = 'toggleSelectBoxes();';
thisContainer.onscroll = new Function(onClickAction);
}

/* Only WinIE will fire this function. All other browsers scroll the TBODY element and not the DIV */
/* This is to hide the SELECT elements from scrolling over the fixed Header. WinIE only.           */
/* toggleSelectBoxes added on 2005-01-28 */
/* Terence Ordona, portal[AT]imaputz[DOT]com         */
function toggleSelectBoxes() {
var thisContainer = document.getElementById('tableContainer');
var thisHeader = document.getElementById('fixedHeader');
if (!thisContainer || !thisHeader) { return; }

var selectBoxes = thisContainer.getElementsByTagName('select');
if (!selectBoxes) { return; }

for (var i = 0; i < selectBoxes.length; i++) {
	if (thisContainer.scrollTop >= eval(selectBoxes[i].parentNode.offsetTop - thisHeader.offsetHeight)) {
		selectBoxes[i].style.visibility = 'hidden';
	} else {
		selectBoxes[i].style.visibility = 'visible';
	}
}
} 

window.onload = function() { stripedTable(); addIEonScroll(); }
-->
</script>
<style type="text/css">
<!--
/* Terence Ordona, portal[AT]imaputz[DOT]com         */
/* http://creativecommons.org/licenses/by-sa/2.0/    */

/* begin some basic styling here                     */
body {
background-position: 0% 0%;
font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif;
margin: 10px;
padding: 0;
background-repeat: repeat;
background-attachment: scroll;
}

table, td, a {
color: #000;
font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif
}

h1 {
font: normal normal 18px Verdana, Geneva, Arial, Helvetica, sans-serif;
margin: 0 0 5px 0
}

h2 {
font: normal normal 16px Verdana, Geneva, Arial, Helvetica, sans-serif;
margin: 0 0 5px 0
}

h3 {
font: normal normal 13px Verdana, Geneva, Arial, Helvetica, sans-serif;
color: #008000;
margin: 0 0 15px 0
}

/* end basic styling                                 */


/* define height and width of scrollable area. Add 16px to width for scrollbar          */
/* allow WinIE to scale 100% width of browser by not defining a width                   */
/* WARNING: applying a background here may cause problems with scrolling in WinIE 5.x   */
div.tableContainer {
clear: both;
border: 1px solid #963;
height: 285px;
overflow: auto;
width: 756px;
}

/* WinIE 6.x needs to re-account for it's scrollbar. Give it some padding */
\html div.tableContainer/* */ {
padding: 0 16px 0 0;
width: 740px;
}

/* clean up for allowing display Opera 5.x/6.x and MacIE 5.x */
html>body div.tableContainer {
height: auto;
padding: 0;
}

/* Reset overflow value to hidden for all non-IE browsers. */
/* Filter out Opera 5.x/6.x and MacIE 5.x                  */
head:first-child+body div[class].tableContainer {
height: 285px;
overflow: hidden;
width: 756px
}

/* define width of table. IE browsers only                 */
/* if width is set to 100%, you can remove the width       */
/* property from div.tableContainer and have the div scale */
div.tableContainer table {
float: left;
width: 100%
}

/* WinIE 6.x needs to re-account for padding. Give it a negative margin */
\html div.tableContainer table/* */ {
margin: 0 -16px 0 0
}

/* define width of table. Opera 5.x/6.x and MacIE 5.x */
html>body div.tableContainer table {
float: none;
margin: 0;
width: 740px
}

/* define width of table. Add 16px to width for scrollbar.           */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
head:first-child+body div[class].tableContainer table {
width: 756px
}

/* set table header to a fixed position. WinIE 6.x only                                       */
/* In WinIE 6.x, any element with a position property set to relative and is a child of       */
/* an element that has an overflow property set, the relative value translates into fixed.    */
/* Ex: parent element DIV with a class of tableContainer has an overflow property set to auto */
thead.fixedHeader tr {
position: relative;
/* expression is for WinIE 5.x only. Remove to validate and for pure CSS solution      */
top: expression(document.getElementById("tableContainer").scrollTop);
}

/* set THEAD element to have block level attributes. All other non-IE browsers            */
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
/* Filter out Opera 5.x/6.x and MacIE 5.x                                                 */
head:first-child+body thead[class].fixedHeader tr {
display: block;
}

/* make the TH elements pretty */
thead.fixedHeader th {
background: #C96;
border-left: 1px solid #EB8;
border-right: 1px solid #B74;
border-top: 1px solid #EB8;
font-weight: normal;
padding: 4px 3px;
text-align: left
}

/* make the A elements pretty. makes for nice clickable headers                */
thead.fixedHeader a, thead.fixedHeader a:link, thead.fixedHeader a:visited {
color: #FFF;
display: block;
text-decoration: none;
width: 100%
}

/* make the A elements pretty. makes for nice clickable headers                */
/* WARNING: swapping the background on hover may cause problems in WinIE 6.x   */
thead.fixedHeader a:hover {
color: #FFF;
display: block;
text-decoration: underline;
width: 100%
}

/* define the table content to be scrollable                                              */
/* set TBODY element to have block level attributes. All other non-IE browsers            */
/* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */
/* induced side effect is that child TDs no longer accept width: auto                     */
/* Filter out Opera 5.x/6.x and MacIE 5.x                                                 */
head:first-child+body tbody[class].scrollContent {
display: block;
height: 262px;
overflow: auto;
width: 100%
}

/* make TD elements pretty. Provide alternating classes for striping the table */
/* http://www.alistapart.com/articles/zebratables/                             */
tbody.scrollContent td, tbody.scrollContent tr.normalRow td {
background: #FFF;
border-bottom: none;
border-left: none;
border-right: 1px solid #CCC;
border-top: 1px solid #DDD;
padding: 2px 3px 3px 4px
}

tbody.scrollContent tr.alternateRow td {
background: #EEE;
border-bottom: none;
border-left: none;
border-right: 1px solid #CCC;
border-top: 1px solid #DDD;
padding: 2px 3px 3px 4px
}

/* define width of TH elements: 1st, 2nd, and 3rd respectively.      */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
/* Add 16px to last TH for scrollbar padding                         */
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors    */
head:first-child+body thead[class].fixedHeader th {
width: 200px
}

head:first-child+body thead[class].fixedHeader th + th {
width: 240px
}

head:first-child+body thead[class].fixedHeader th + th + th {
border-right: none;
padding: 4px 4px 4px 3px;
width: 316px
}

/* define width of TH elements: 1st, 2nd, and 3rd respectively.      */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
/* Add 16px to last TH for scrollbar padding                         */
/* http://www.w3.org/TR/REC-CSS2/selector.html#adjacent-selectors    */
head:first-child+body tbody[class].scrollContent td {
width: 200px
}

head:first-child+body tbody[class].scrollContent td + td {
width: 240px
}

head:first-child+body tbody[class].scrollContent td + td + td {
border-right: none;
padding: 2px 4px 2px 3px;
width: 300px
}
-->
</style>
</HEAD>
<BODY>
<TABLE width=600 border=0 cellPadding=0 cellSpacing=0>
<TR>
<TD background=images/image4.gif width="20"> </TD>
<TD bgcolor="#7D92A9">
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<TR>
<TD bgColor=black>     
<TABLE border=0 cellPadding=0 cellSpacing=1 width="100%">
<TR>
<TD bgColor=#6699FF colSpan=1><font face="arial" size="2" color="black"><?php echo $tname1 ?></font></TD>
<TD bgColor=#6699FF colSpan=1><font face="arial" size="2" color="black"><?php echo $tname2 ?></font></TD>
<TD bgColor=#6699FF colSpan=1><font face="arial" size="2" color="black"><?php echo $tname3 ?></font></TD>
</TR>
<?php
//Clean PHP_SELF by gfx-depot.com
$phpself = basename(__FILE__);
$_SERVER['PHP_SELF'] = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'],
$phpself)) . $phpself;
// connect to db
// select db
$db_host = "$host";
$db_username = "$username";
$db_password = "$password";
$db_name = "$name";
$sortby = $_GET['sort'];
$sortteat = $_GET['sortty'];
$conn = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error());
mysql_select_db($db_name, $conn);

$myquery = mysql_query("select * from $SS1db");
//ORDER BY $sortby $sortteat
while($row = mysql_fetch_array($myquery)){
extract($row);
echo "<TR>";
echo "<TD bgColor=#ffffff>$websitenumber</TD>";
echo "<TD bgColor=#ffffff>$timeava</TD>";
echo "<TD bgColor=#ffffff>$orderdata</TD>";
echo "</TR>";
}
?>
</TABLE>
</TD>
</TR>
</TBODY>
</TABLE>
</TD>
</TR>
</TABLE>
<p> </p>
      <?php echo $_POST["orderdata"]; ?>
</BODY>
</HTML>

 

What its suppose to do as you can see it reads data from a MYSQL database:

--
-- Table structure for table `orderwebsite`
--

CREATE TABLE IF NOT EXISTS `orderwebsite` (
  `id` int(255) NOT NULL auto_increment,
  `websitenumber` int(255) NOT NULL,
  `timeava` int(255) NOT NULL,
  `orderdata` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `orderwebsite`
--

INSERT INTO `orderwebsite` (`id`, `websitenumber`, `timeava`, `orderdata`) VALUES
(1, 1, 5, '<form action="neworderwebsite.php" method="post"><input type="submit" value="Order Now!"><input name="orderdata" type="hidden" value=''<form action="neworderwebsite.php" method="post">    Website Order Number: <?php echo $_POST["websiteechonumber"]; ?><br>    Available Work Time: <?php echo $_POST["echotimeava"]; ?><br>    First Name:<input type="text" name="firstname"><br>    Last Name:<input type="text" name="lastname"><br>    Email:<input type="text" name="youremail"><br>    <input type="submit" value="Submit"></form><br>    Please Use a valid Name and email so we can contact you to make your website''><input type="hidden" name="websiteechonumber" value="1"><input type="hidden" name="echotimeava" value="5"></form>'),
(2, 2, 3, '<form action="neworderwebsite.php" method="post"><input type="submit" value="Order Now!"><input name="orderdata" type="hidden" value=''<form action="neworderwebsite.php" method="post">    First Name:<input type="text" name="firstname"><br>    Last Name:<input type="text" name="lastname"><br>    Email:<input type="text" name="youremail"><br>    <input type="submit" value="Submit"></form><br>    Please Use a valid Name and email so we can contact you to make your website''></form>');

 

That has the HTML from the top of the this topic as you can see when the neworderwebsite.php which brings out the html code from the database you should be able to click Order Now! it displays another form which should also echo the POST of websiteechonumber and echotimeava but it doesnt what is wrong thanks and also another thing is the submit button seems to of magicly turned into a Text box i know these errors will be coming well i think one of them because its in a MYSQL database but its needed for what im doing

Thanks Alot :)

Link to comment
https://forums.phpfreaks.com/topic/112901-help-with-proberly-simple-error/
Share on other sites

let's start with the first block of code...the form. i copied it into my text editor, added new lines, and now it looks like this (which obviously is wrong):

 

<form action="neworderwebsite.php" method="post">
  <input type="submit" value="Order Now!">
  <input name="orderdata" type="hidden" value='
  
<form action="neworderwebsite.php" method="post">
      Website Order Number: <?php echo $_POST["websiteechonumber"]; ?><br>
      Available Work Time: <?php echo $_POST["echotimeava"]; ?><br>
      First Name:<input type="text" name="firstname"><br>
      Last Name:<input type="text" name="lastname"><br>
      Email:<input type="text" name="youremail"><br>
      <input type="submit" value="Submit">
</form><br>
    Please Use a valid Name and email so we can contact you to make your website

'>
<input type="hidden" name="websiteechonumber" value="1">
<input type="hidden" name="echotimeava" value="5">
</form>

 

did you copy/paste wrong into the post or is this the code you are using? i assume it's supposed to be more like this:

<form action="neworderwebsite.php" method="post">
      Website Order Number: <?php echo $_POST["websiteechonumber"]; ?><input type="hidden" name="websiteechonumber" value="<?php echo $_POST["websiteechonumber"]; ?>"><br>
      Available Work Time: <?php echo $_POST["echotimeava"]; ?><input type="hidden" name="echotimeava" value="<?php echo $_POST["echotimeava"]; ?>"><br>
      First Name:<input type="text" name="firstname"><br>
      Last Name:<input type="text" name="lastname"><br>
      Email:<input type="text" name="youremail"><br>
      <input type="submit" value="Order Now!">
</form><br>
    Please Use a valid Name and email so we can contact you to make your website

 

hidden input fields can't have "special" characters like < > ' in them. you have to encode them first. try this:

 

<?php
$form = '<form action="neworderwebsite.php" method="post">
      Website Order Number: '.$_POST["websiteechonumber"].'<br>
      Available Work Time: '.$_POST["echotimeava"].'<br>
      First Name:<input type="text" name="firstname"><br>
      Last Name:<input type="text" name="lastname"><br>
      Email:<input type="text" name="youremail"><br>
      <input type="submit" value="Submit">
</form><br>
    Please Use a valid Name and email so we can contact you to make your website';
?>
<form action="neworderwebsite.php" method="post">
  <input type="submit" value="Order Now!">
  <input name="orderdata" type="hidden" value="<?php echo htmlspecialchars($form); ?>">
<input type="hidden" name="websiteechonumber" value="1">
<input type="hidden" name="echotimeava" value="5">
</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.