1

I have made a plain PHP widget to be displayed on a WordPress sidebar. I have successfully made the widget post the data I am hoping to have filled in on the consecutive page. However where it is supposed to be will not fill in, instead it fills in with "<?php echo $_GET[" then after the text box " />". I am hoping that the email first submitted will fill in on the form on the next page. The code that I have for the registration form is part of a greater widget and looks like the following:

<p class="form-email'.$errorVar.'">
      <label for="email">'. __('E-mail', 'profilebuilder') .$errorMark.'</label>
      <input class="text-input" name="email" type="text" id="email" value="<?php echo $_GET["email"]; ?>" /> 
</p><!-- .form-email -->';

Here is a link to the page: http://universityoutfitters.com/testphp/ — the widget is on the bottom left hand side panel.

Additional information: The code for the widget is as follows:

<form action="http://universityoutfitters.com/sign-up/" method="post">
    Please submit your email address
    Email: <input type="text" name="email" />
<input type="submit" />
</form> 
5
  • 4
    You can't mix PHP and HTML like that, wrap all your PHP code in <?php ?>. Commented Apr 27, 2012 at 20:11
  • You mean the get variable doesn't work for you? Commented Apr 27, 2012 at 20:12
  • value="<?php echo $_GET["email"]; ?>" Is it not wrapped? Commented Apr 27, 2012 at 20:28
  • @AlexanderCharles - @bfavaretto is referring to your <label> tag. Commented Apr 27, 2012 at 20:51
  • You're stepping into PHP without a declaration here: "email">'. __('E-mail' Commented Apr 27, 2012 at 20:59

2 Answers 2

1

This line should be:

<label for="email"><?php echo __('E-mail', 'profilebuilder') $errorMark ;?></label>
Sign up to request clarification or add additional context in comments.

Comments

0

As the comments told above, you have to wrap it correctly with PHP tags

<?php
echo '<p class="form-email'.$errorVar.'">
      <label for="email">'. __('E-mail', 'profilebuilder') .$errorMark.'</label>
      <input class="text-input" name="email" type="text" id="email" value="'.$_GET["email"].'" /> 
</p><!-- .form-email -->';
?>

1 Comment

This creates a larger error and does not allow the site to load.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.