Jump to content

colocar registo no value


diokhan

Recommended Posts

boas,

eu estou com um problema, eu faço uma query para buscar um registo a base de dados, e quando tento colocar esse valor no value da input aparece assim na minha pagina "Tentativareadonly="

e eu só queria que aparecesse "Tentativa"

este é o meu código neste momento:

<?php 
require_once('./admin/constantes.php');
require_once ('./functions.php');

$projects = new Project;
$projects->GetProjectById($_GET['id']);
$nameproject = $projects->GetNameProject();
$description = $projects->GetDescription();
$idplate = $projects->GetIdPlate();
$date = $projects->GetDate();
//$projectType = $projects->GetProjectType();


echo"

		<h3 align=center>Project:</h3>
			<div id='maintask' style='border-width:1px; border-style:solid; border-color:grey'>
				Name Project:<span style='padding-left: 10px'><input type='text' name='nameProject' size='100' value='$nameproject' readonly='readonly'></span><br>
			    Project Description:<span style='padding-left: 24px'><textarea name='description' rows='15' cols='80' style='width: 100%;'>$description</textarea></span><br />
			    ID Plate:<span style='padding-left: 43px'><input type='text' name='idPlate' size='15' value='$idplate' readonly='readonly'></span><br>
			    Date:<span style='padding-left: 61px'><input type='text' name='Date' size='15' value='$date' readonly='readonly'/></span><br />";

				$sql2 = "SELECT project_type.NAME_PROJECT_TYPE
								FROM project_type
								Inner Join project ON project_type.ID_PROJECT_TYPE = project.ID_PROJECT_TYPE 
								WHERE project.ID_PROJECT =  $_GET[id]";

				foreach ($dbh->query($sql2) as $row){
				echo"Project Type:<span style='padding-left: 17px'><input type='text' name='Date' size='15' value='".print $row[NAME_PROJECT_TYPE]."' readonly='readonly'/></span><br />";
				}
				echo"</div>";

?>

...Join the dark side...and get a free cookie...

Link to comment
Share on other sites

Resolvido...era só tirar o print, o código tinha que ficar assim na input:

$sql2 = "SELECT project_type.NAME_PROJECT_TYPE
								FROM project_type
								Inner Join project ON project_type.ID_PROJECT_TYPE = project.ID_PROJECT_TYPE 
								WHERE project.ID_PROJECT =  $_GET[id]";

				foreach ($dbh->query($sql2) as $row){
					echo "Project Type:<span style='padding-left: 17px'><input type='text' name='Date' size='15' value=".$row[NAME_PROJECT_TYPE]." readonly='readonly'/></span><br />";
				}
				echo"</div>";

😁

...Join the dark side...and get a free cookie...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.