Jump to content

outputting db content in a form


logicopinion

Recommended Posts

hey.

using this code i want to print out the content of the databse in forms where i can edit them and then update again

<form action="index.php?p=itm1" method="post">

<table border="0" cellpading="1" cellspacing="0">

<TR><TD height="50" class="titles" colspan="3" align="center">  თუ გსურსთ მენიუს დაამატოთ ახალი ჩანართი, ჩაწერეთ ახალი ჩანართის სახელი</TD></TR>

<?php
include("includes/vars.php");
mysql_connect("$hostname",  "$username",  "$password") or die(mysql_error());
mysql_select_db("$database") or die(mysql_error());
$query = "SELECT * FROM $navigation ORDER BY id ASC";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))

{
print "<form ection=\"update_menu.php\ method=\"post\">";
print "<table  class='titles' border='0' cellpadding='0' cellspacing='0' width='100%'>";
print "<TR><TD style=\"BORDER-TOP:1px #f9f9f9 solid; BORDER-BOTTOM:1px #f9f9f9 solid; BORDER-RIGHT:1px #f9f9f9 solid; BORDER-LEFT:1px #f9f9f9 solid;\"; height=\"30\"><input class=\"login\" type=\"text\"  size=\"50\" value=".$row['item']."></TD></TR>";
print "</table>";
}
?>

 

 

when i tried just to echo to row['item'] everything was fine

but now i am trying to output them in a form where it can be edited.. and here it comes with an error.

 

this is the list of the names of links which are listed on my web pages navigation menu.

 

forexaple

> news

> staff

> bulletin board

> etc..

 

and when i output this items using echo they are choed as they are in database... (some of them consist of two words (bulletin board) forexample)

 

but when i output them in a form.

 

like this

 

<input type=\"text\" value=".$row['item'].">

 

 

it comes whith such error.

 

if using comand echo "bulletin board was echoed"

in form instead of "bulletin boar" only word bulletin is echoed.. mean second word is lost somewhere... have no idea why?

 

any suggestations?

 

 

thank you

Link to comment
Share on other sites

If there is a space in the name you have to enclose it in quotes

<input class=\"login\" type=\"text\"  size=\"50\" value=\"".$row['item']."\">

 

also you may want to give the input a name or pretty much going to be useless :)

 

Ray

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.