Pass PHP session variable into HTML form
20,187
Solution 1
This should work...the quote before value was probably screwing it up
<input type="text" name="email" id="email" size="36" value="<?php echo $_SESSION['newsletterSignup'];?>" class="text-input" onBlur="emailval()" />
Solution 2
you use
<input type="text" name="email" id="email" size="36" "value="<?php echo $_SESSION['newsletterSignup'];?>" class="text-input" onBlur="emailval()" />
A "
to many. Here is the fix
<input type="text" name="email" id="email" size="36" value="<?php echo $_SESSION['newsletterSignup'];?>" class="text-input" onBlur="emailval()" />
Also, did you use session_start(); ?
Author by
DLO
Updated on April 05, 2020Comments
-
DLO about 4 years
I have session variables that are posted from a form on another php page, and I can echo them by using:
<?php $_SESSION['newsletterSignup'] = $_POST['newsletterSignup']; echo "Email = ". $_SESSION['newsletterSignup']; ?>
But I can't seem to insert these into a HTML form field:
<input type="text" name="email" id="email" size="36" "value="<?php echo $_SESSION['newsletterSignup'];?>" class="text-input" onBlur="emailval()" />
-
jwueller about 11 years@DLO - Do you use an editor or IDE with syntax highlighting? It makes those things very easy to spot.
-
DLO about 11 yearsUsing Dreamweaver atm, but do have eclipse