Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Translate this read a cookie to output in input field from coldfusion to php?

How would I translate this coldfusion code to php?

<td align="left" colspan="2">
<cfif #IsDefined("COOKIE.EMAIL")#>
<cfinput type="Text" name="EMAIL" message="Please enter a valid HP E-mail address" required="Yes" size="35" value="#COOKIE.EMAIL#">
<cfelse>
<cfinput type="Text" name="EMAIL" message="Please enter a valid HP E-mail address" required="Yes" size="35">
</cfif>
</td>
<td>
<cfif IsDefined("cookie.PHONE")>
<cfinput type="Text" name="PHONE" message="Please enter your phone number" required="Yes" maxlength="15" value="#cookie.PHONE#">
<cfelse>
<cfinput type="Text" name="PHONE" message="Please enter your phone number" required="Yes" maxlength="15">
</cfif>
</td>
0
lhaluska
Asked:
lhaluska
1 Solution
 
administradoresCommented:
The code below should do thhe work:

<?php

$email = isset($_COOKIE['EMAIL']);
$phone = isset($_COOKIE['PHONE']);

echo '<td align="left" colspan="2">';
echo '<input type="text" name="EMAIL" title="Please enter a valid HP E-mail address" size="35" ' . (($email) ? 'value="' . $_COOKIE['EMAIL'] : '') . "\" />\n</td>\n<td>\n";
echo '<input type="text" name="PHONE" title="Please enter your phone number"  maxlength="15" ' . (($phone) ? 'value="' . $_COOKIE['PHONE'] : '') . "\" />\n</td>";

?>
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now