Empty value from mysql into php form

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
publicGenome
Forum Contributor
Posts: 110
Joined: Thu Apr 16, 2015 7:55 am

Empty value from mysql into php form

Post by publicGenome »

Hi There,
I'm a noob in web development, thus kindly pardon my naive query.
Work flow of my page:
pull data/row from mysql. Data has a certain column which may or many not be blank. Column name: reverse primer. I'm pulling information, and trying to display that in a html form in PHP page.

Code: Select all

		foreach ($result as $row){
			echo "<tr>";	
			
			echo "<td>"."<input name=study disabled value=".$row['study']." </td>";
			echo "<td>"."<input name=forward_primer disabled value=".$row['forward_primer']." </td>";
			echo "<td>"."<input name=reverse_primer disabled value=".$row['reverse_primer']."  </td>";
			echo "<td>"."<input name=seq_platform disabled value=".$row['seq_platform']." </td>";
			
			echo "</tr>";
		}
Here at the td with reverse primer row, I get </td > shown in the attached screen shot. How do I disable to stop it from doing? Even if I send to a function, check it, I still will have null, unless I decide it to show NA or otherwise.

Best,
pG
Attachments
td with blank reverse primer
td with blank reverse primer
publicGenome
Forum Contributor
Posts: 110
Joined: Thu Apr 16, 2015 7:55 am

Re: Empty value from mysql into php form

Post by publicGenome »

Hi There,
An update:

I was able to fix this using single quotes around reverse_primer variable:

echo "<td>"."<input name=reverse_primer disabled value='".$row['reverse_primer']."' /></td>";
Post Reply