Question

Using php/html, I want to retrieve email addresses (plus other information) from MySQL and then display the email addresses in an input box on a form. This will enable users to edit and submit corrected email addresses. However the retrieved email address does not display correctly in the input box. All other retrieved information display correctly. A section of the code is as shown below:

 <tr><td ><span style=color:#125eaa><strong>Email</strong></style></td><td ><input style=background-color:#e2ffc6 name=email type=text id=email value=$email></td></tr>
<tr><td ><span style=color:#125eaa><strong> Address Line 1</strong></style></td><td ><input style=background-color:#e2ffc6 name=ad1 type=text id=ad1 value='$ad1'></td></tr> 

The "Address Line 1" displays correctly but the email does not. I tried: type=email, but it did not resolve the issue.

enter image description here

Any help greatly appreciated.

Thanks,

Was it helpful?

Solution

<tr><td><span style="color:#125eaa;"><strong>Email</strong></span></td><td><input style="background-color:#e2ffc6;" name="email" type="text" id="email" value="<?php echo $email; ?>" /></td></tr>

<tr><td><span style="color:#125eaa;"><strong>Address Line 1</strong></span></td><td><input style="background-color:#e2ffc6;" name="ad1" type="text" id="ad1" value="<?php echo $ad1; ?>" /></td></tr> 

Put quotes around all attributes. And, without seeing more code I can only assume you need to display the variables with php, not simply straight HTML. You've also got closing </style> tags instead of closing </span> tags.

OTHER TIPS

His problem could be an artifact of a resident javascript that's cloaking the e-mail address with a script obfuscation, which is why he's seeing part of the opening script tag. Disable the cloaking script before writing e-mail addresses to values in input statements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top