Choose place where write text

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Choose place where write text

Post by mariolopes »

HI
I need to select one item from one database and write the result field in one place of my webpage, but when I write with echo"xxxx" it writes the value at the begining of the page. How can i choose the place where i write the result? I have to use css?
Thank you
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: Choose place where write text

Post by s.dot »

Hi,

Please show us your code. echoing something should place it right where you put the echo. I've seen cases where it doesn't, such as in templating.. so your code will be necessary.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Re: Choose place where write text

Post by mariolopes »

HI
Here is my code:
One of my options was try to write the value in one input named designacao but it seems doesn't work.

Code: Select all

 
<?php
session_start();
include "tab.html";
echo"<link href='negocios.css' rel='stylesheet' type='text/css'>\n";
echo"<div class=formulario>";
echo"<form  method='POST' >";
echo"  <fieldset>";
echo"    <legend>Pesquisa:</legend>";
echo"    Código:        <input type='text' name='codigo' size='10' />";
echo"    <input type='Submit' value='Pesquisar'/>";
echo"<br/>";
echo"<br/>";
echo"Designação: <input type='text' name='designacao' size='50' value='";echo $descricao;echo "' />";
echo"  </fieldset>";
echo"</form>";
echo"</div>";
$mysql_id = mysql_connect('localhost', "xxx", "xxx");
mysql_select_db('mariolopes',$mysql_id);
if (isset($_POST['codigo'])){
        $query="select * from negocios where Codigo='$_POST[codigo]'";
        $result=mysql_query($query);
        $numlinhas=mysql_num_rows($result);
        echo $numlinhas;
if ($numlinhas==0){
$_SESSION['descricao']="";  
echo "Sem linhas";
exit;
}
while ($row=mysql_fetch_array($result)){
        $descricao=$row['Designacao'];      
        echo $descricao;        
}
}   
?>
lshaw
Forum Commoner
Posts: 69
Joined: Mon Apr 20, 2009 3:40 pm
Location: United Kingdom

Re: Choose place where write text

Post by lshaw »

You only have echo statments at the top of the page, so where do you think they will appear?
Post Reply