0

Here's what I'm looking to accomplish. When a user creates a profile they fill out some information with a form. After they submit the form the information is displayed on their profile. One of the form fields is going to be a button that other users can click to do an action. To display the button this is the PHP I currently have:

add_action('kleo_bp_after_profile_name', 'my_profile_button');
function my_profile_button()
{
echo '<a href="#" class="success button radius show-for-small" rel="nofollow">Talk</a>';
}

I need to input the form information into the href="#" spot. Does anyone know a way around this?

Thanks.

14
  • if i understand you correctly then you will need to use javascript for that Commented Oct 9, 2013 at 19:16
  • Use jQuery to solve this Commented Oct 9, 2013 at 19:16
  • 4
    Hard to understand what you have and what you're trying to do. How do you put information into a button? What are you actually trying to accomplish? Submit the information to a server? Commented Oct 9, 2013 at 19:16
  • 4
    The href='#' of what? Commented Oct 9, 2013 at 19:16
  • 1
    what's wrong with a standard html form approach? Commented Oct 9, 2013 at 19:17

2 Answers 2

1

It sounds like you want to simply submit a form that a user fills out. If that is the case, you can't use a link, but you need to use a button:

<form action="submitpage.php" method="post">
    Name: <input type="text" />
    <input type="submit" value="Some Text" />
</form>

or

<form action="submitpage.php" method="post">
    Name: <input type="text" />
    <button type="submit" class="success button radius show-for-small">Some Text</button>
</form>
Sign up to request clarification or add additional context in comments.

Comments

0

Sure, if you have captured that information with a POST variable, named 'redirect' for example, you could use it to generate a button. The problem is that I don't understand very well what you mean with be put into href="#" spot, because buttons don't have that property, so I write you the code to use it on a redirection which is done at clicking the button:

<input type="button" value="submit" onclick="location.href='<?php echo $_POST["redirect"];?>';">

If you want to use information in a link, which actually have href property use this:

<a id="link" href="<?php echo $_POST['redirect'];?>">Text of the link</a>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.