1 Replies - 276 Views - Last Post: 05 August 2009 - 03:42 AM Rate Topic: -----

#1 fallen0ne09  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 45
  • Joined: 13-March 09

Adding a form tag inside an sql syntax

Posted 05 August 2009 - 03:14 AM

i have a problem in my coding, i dont know how to combine a form inside an sql syntax, and it also has an image attached to it... i tried other things but still does not work please take a look at it.. here is my code
<?php   
								// Grab the data from our people table
								$sql = 'SELECT * FROM `item` ORDER BY `item`.`id` DESC LIMIT 0, 30 '; 
								$result = mysql_query($sql) or die ("Could not access DB: " . mysql_error());

								while ($row = mysql_fetch_assoc($result))
								{
										echo "<div class=\"picture\">";
										echo "<p>";

										// Note that we are building our src string using the filename from the database
										echo "<center><img src=\"images/"  . $row['filename'] . "\" alt=\"\"  /><br />";
										print(" ID No = ".$row['id']."<br>");
										 print(" Name = ".$row['name']."<br>");
										print("   Description: ".$row['description']."<br>");
										print("   Price: "."<b>P</b>".$row['price'].".00"."<br>");
										print("   Sizes: ".$row['small']." ".$row['meduim']." ".$row['large']." "."<br>");
										echo "Item Type: ".$row['type']."<br>";
										echo "<form action=""><input type="radio"></form>"<br>";
										print("<br>"."<br>"."<br>");
										echo "</p>";
										echo "</div>";
								}

						?>	



here is the error
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in C:\wamp\www\order1.php on line 121
i wanted to add a radio or checkbox in every retrieve of data from the database, and the checkbox would have the value or the name of its data, please help me... i dont know what to do next...

Is This A Good Question/Topic? 0
  • +

Replies To: Adding a form tag inside an sql syntax

#2 BenignDesign  Icon User is offline

  • I cause cancer.
  • member icon




Reputation: 4657
  • View blog
  • Posts: 8,885
  • Joined: 28-September 07

Re: Adding a form tag inside an sql syntax

Posted 05 August 2009 - 03:42 AM

echo "<form action=\"test.php\" method=\"post\"><input type=\"radio\" name=\"option\" value=\"1 \" /></form><br />";



By the way, you don't NEED double quotes inside your double quotes, hell it may not even work properly as is.

here's how I would do it:
echo "<form action='test.php' method='post'><input type='radio' name='option' value='1' /></form><br />";



You're also missing a submit button.

This post has been edited by BenignDesign: 05 August 2009 - 03:48 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1