Jump to content

Not Returning Full Value of Field


Madnhain

Recommended Posts

Greetings! I'm not sure if this is a PHP issue or MYSQL, but here it is:

 

When I request the value from my database, it only returns to value to the point of the first space. For example if I insert "This is Data" into my database, when I select that field, the it will only display "This" It's not a length limit, I've tried replacing spaces with underscores, and it works fine, though ugly. So I'm thinking it's gotta be some kind of other issue. I'm using Type MyISAM and Collation is utf8_unicode_ci.

 

Thanks!

Link to comment
Share on other sites

here's some code snippets:

Input information:

 

<form action="main.php?content=process_new_daily_report" method="post">

	<table width="788" border="0" cellspacing="2" cellpadding="0">

		<tr height="30">

			<td colspan="3">Pad / Well Names</td>

			<td colspan="4"><input type="text" name="i_Pad_Well_Names_1" size="24" /></td>

		</tr>

...
	<input type="submit" value="Submit" />

</form>

 

 

 

Process information:

$i_Pad_Well_Names_1 = $_POST['i_Pad_Well_Names_1'];

    $query = "INSERT INTO daily_reports (i_Pad_Well_Names_1, ) VALUES ('$i_Pad_Well_Names_1')";  

 

 

Retrieve Information:

$reportid = $_REQUEST['report'];

$query = "SELECT * FROM daily_reports WHERE reportid = $reportid";

$result=mysql_query($query);

$row = mysql_fetch_array($result, MYSQL_ASSOC);

$i_Pad_Well_Names_1 = $row['i_Pad_Well_Names_1'];

<input type='text' name='i_Pad_Well_Names_1' size='24' value=<?php echo $i_Pad_Well_Names_1 ?>>

 

 

There are around 40 of entries that need to be entered, processed, and retrieved, all part of the same report (they are retrieved into an input field so they can be reviewed or modified) I only gave 1 of the many to keep the code short for this post, but all fields suffer the same problem.

 

Thanks!

Link to comment
Share on other sites

I think that's because he removed the other 39 fields when he posted the code.

oops ;/  That's a lot anyway, but a whole different design issue.

 

As fenway suggested, echo out your values when you're passing them from the HTML form, to the processing form (before you insert) to make sure the values are correct.

Link to comment
Share on other sites

This is your code -

<input type='text' name='i_Pad_Well_Names_1' size='24' value=<?php echo $i_Pad_Well_Names_1 ?>>

 

This is your code as valid HTML -

<input type='text' name='i_Pad_Well_Names_1' size='24' value='<?php echo $i_Pad_Well_Names_1 ?>'>

 

I also recommend that you use htmlentities, with the second parameter set to ENT_QUOTES, on any data values you echo on a page so that any html special characters in the data (<, >, ', ", &) don't also break the HTML on your page.

 

Link to comment
Share on other sites

yes, there are some errors with quotations and syntax, because I did in fact remove a massive amount of code, and just pasted a sample of the pertinent lines. would it be more helpful if I just pasted the code in its entirety?

 

Link to comment
Share on other sites

yes, there are some errors with quotations and syntax, because I did in fact remove a massive amount of code, and just pasted a sample of the pertinent lines. would it be more helpful if I just pasted the code in its entirety?

Never.  But I doubt you removed single quotes when you cut & pasted.

Link to comment
Share on other sites

Thanks for the tips guys, I'll give it a shot adjusting the quotes, though I fail to see how that would give me partial data return. The echo out info is one of those "duh" moments that I should have thought of... thanks for that. I will give an update in a few days, unfortunately I won't be able to test these for a few days.

 

Thank you again for your assistance!

 

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.