Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hyperlink in PHP

Status
Not open for further replies.

moving2009

Technical User
Sep 25, 2009
3
0
0
US
All,
I am very new to PHP and I have searched through the threads here and can't find the answer I am looking for.

I need to add a hyperlink to PHP code, which follows:

Code:
<div class='field_block' id='field_9_div'>
	<label class='form_field'>Terms and Conditions</label><br>
	<?php phpfmg_checkboxes( 'field_9', "I have read and agree to the Terms and Conditions set forth by The Missing Piece, LLC.  (Please note that without accepting these terms, we will not provide coaching services or accept your registration.)  You may read and print the conditions here." );?>
	<? phpfmg_field_instruction('field_9'); ?>
</div>

Where it reads "You may read and print the conditions here."

I need the word here to hyperlink to the following:

Code:
<a href="[URL unfurl="true"]http://www.everywomansnorthstar.com/terms.html">here</a>[/URL]

Can someone tell me how to put in the hyperlink for the code above, so the word here links to the link above?

Any help would be appreciated.

Thanks in advance.
 
you have not shown us the function
Code:
phpfmg_checkboxes]/code]  so we don't know whether it does any silly character entity replacement.

assuming not

[code]
<?php phpfmg_checkboxes( 'field_9', "I have read and agree to the Terms and Conditions set forth by The Missing Piece, LLC.  (Please note that without accepting these terms, we will not provide coaching services or accept your registration.)  You may read and print the conditions <a href="[URL unfurl="true"]http://www.everywomansnorthstar.com/terms.html">here</a>"[/URL] );?>

or perhaps (if entity replacement is done by the function)
Code:
<?php phpfmg_checkboxes( 'field_9', "I have read and agree to the Terms and Conditions set forth by The Missing Piece, LLC.  (Please note that without accepting these terms, we will not provide coaching services or accept your registration.)  You may read and print the conditions " );?><a href="[URL unfurl="true"]http://www.everywomansnorthstar.com/terms.html">here</a>[/URL]
 
Your second option worked, but the here fell on the line below conditions. How do I get the here to go right after conditions?

Here is the entire code:

Code:
<?php
# Generated by : [URL unfurl="true"]http://phpfmg.sourceforge.net[/URL]

# This block must be placed at the very top of page.
# -----------------------------------------------------------------------------
require_once( 'form.lib.php' );
header( 'Content-Type: text/html; charset=' . PHPFMG_CHARSET );
$phpfmg_send = phpfmg_sendmail( $form_mail ) ;
$isHideForm  = isset($phpfmg_send['isHideForm']) ? $phpfmg_send['isHideForm'] : false;
$sErr        = isset($phpfmg_send['error'])      ? $phpfmg_send['error']      : '';
# -----------------------------------------------------------------------------


# FormMail main()
# -----------------------------------------------------------------------------
phpfmg_header();
if( !$isHideForm ){
    phpfmg_form($sErr);
}else{
    phpfmg_thankyou();
};
phpfmg_footer();
# -----------------------------------------------------------------------------



function phpfmg_form( $sErr = false ){

?>

<div class='phpfmg_form' summary='Mail form generated by php formmail generator at [URL unfurl="true"]http://phpfmg.sourceforge.net.'[/URL] >

<form name="frmFormMail" action='' method='post' enctype='multipart/form-data' onsubmit='return fmgHandler.onsubmit();'>
<input type='hidden' name='formmail_submit' value='Y'>
<?php
if( $sErr ) print "<br><a name='error'></a><div class='form_error' >" . ERR_MISSING . "</div><br>"; 

		$starColor = $sErr ? "#ff0000" : "#000000";
		$style=" class='form_text' ";
?>

<div class='field_block' id='field_0_div'>
	<label class='form_field'>Name</label> <label class='form_required' >*</label> <br>
	<input type="text" name="field_0"  id="field_0" value="<?php  print HtmlSpecialChars( $_POST[ "field_0" ] ); ?>" class='text_box'>
	<? phpfmg_field_instruction('field_0'); ?>
</div>

<div class='field_block' id='field_1_div'>
	<label class='form_field'>Business Name (if applicable)</label><br>
	<input type="text" name="field_1"  id="field_1" value="<?php  print HtmlSpecialChars( $_POST[ "field_1" ] ); ?>" class='text_box'>
	<? phpfmg_field_instruction('field_1'); ?>
</div>

<div class='field_block' id='field_2_div'>
	<label class='form_field'>Email Address</label> <label class='form_required' >*</label> <br>
	<input type="text" name="field_2"  id="field_2" value="<?php  print HtmlSpecialChars( $_POST[ "field_2" ] ); ?>" class='text_box'>
	<? phpfmg_field_instruction('field_2'); ?>
</div>

<div class='field_block' id='field_3_div'>
	<label class='form_field'>Web URL</label> <label class='form_required' >*</label> <br>
	<input type="text" name="field_3"  id="field_3" value="<?php  print HtmlSpecialChars( $_POST[ "field_3" ] ); ?>" class='text_box'>
	<? phpfmg_field_instruction('field_3'); ?>
</div>

<div class='field_block' id='field_4_div'>
	<label class='form_field'>Would you like a free analysis of our website?</label> <label class='form_required' >*</label> <br>
	<?php phpfmg_checkboxes( 'field_4', "Yes, thank you|No, thank you" );?>
	<? phpfmg_field_instruction('field_4'); ?>
</div>

<div class='field_block' id='field_5_div'>
	<label class='form_field'>Phone Number</label> <label class='form_required' >*</label> <br>
	<input type="text" name="field_5"  id="field_5" value="<?php  print HtmlSpecialChars( $_POST[ "field_5" ] ); ?>" class='text_box'>
	<? phpfmg_field_instruction('field_5'); ?>
</div>

<div class='field_block' id='field_6_div'>
	<label class='form_field'>What you would like to gain from this course?</label> <label class='form_required' >*</label> <br>
	<textarea name="field_6" id="field_6" rows=4 cols=25 class='text_area'><?php  print HtmlSpecialChars( $_POST[ "field_6" ] ); ?></textarea>

	<? phpfmg_field_instruction('field_6'); ?>
</div>

<div class='field_block' id='field_7_div'>
	<label class='form_field'>How did you hear about us?</label> <label class='form_required' >*</label> <br>
	<?php phpfmg_dropdown( 'field_7', "Search Engines|Friend/Business Associate|Advertisement", '' );?>
	<? phpfmg_field_instruction('field_7'); ?>
</div>

<div class='field_block' id='field_8_div'>
	<label class='form_field'>Is there anything else you feel is important for us to know?</label><br>
	<textarea name="field_8" id="field_8" rows=4 cols=25 class='text_area'><?php  print HtmlSpecialChars( $_POST[ "field_8" ] ); ?></textarea>

	<? phpfmg_field_instruction('field_8'); ?>
</div>

<div class='field_block' id='field_9_div'>
	<label class='form_field'>Terms and Conditions</label><br>
	<?php phpfmg_checkboxes( 'field_9', "I have read and agree to the Terms and Conditions set forth by The Missing Piece, LLC.  (Please note that without accepting these terms, we will not provide coaching services or accept your registration.)  You may read and print the conditions " );?><a href="[URL unfurl="true"]http://www.everywomansnorthstar.com/terms.html">here</a>[/URL]
	<? phpfmg_field_instruction('field_9'); ?>
</div>

<div class='field_block' id='field_10_div'>
	<label class='form_field'>The North Star Newsletter</label><br>
	<?php phpfmg_checkboxes( 'field_10', "I would like to be added to TThe North Star which is a no spam newsletter released monthly with informative tips, suggestions, and resources for the Virtual Professional. Read our privacy policy." );?>
	<? phpfmg_field_instruction('field_10'); ?>
</div>

<div class='field_block' id='field_11_div'>
	<label class='form_field'>Privacy Policy</label><br>
	<?php phpfmg_checkboxes( 'field_11', "Please add me to The Missing Piece, LLC's General Information list to receive information on upcoming courses and specials. Read our privacy policy." );?>
	<? phpfmg_field_instruction('field_11'); ?>
</div>
<div class='field_block' id='phpfmg_captcha_div'>
	<label class='form_field'>Security Code:</label> <label class='form_required' >*</label> <br><?php phpfmg_show_captcha(); ?>
</div>
            <div class='form_submit_block'>
	
                <input type='submit' value='Submit' class='form_button'>
                <span id='phpfmg_processing' style='display:none;'>
                    <img id='phpfmg_processing_gif' src='<?php echo PHPFMG_ADMIN_URL . '?mod=image&func=processing' ;?>' border=0> <label id='phpfmg_processing_dots'></label>
                </span>
            </div>

<script type='text/javascript'>
            fmgHandler.init();
            </script>
</form>

</div>

<?php
    if( $sErr ) {
        print "<script language='javascript' type='text/javascript'>location.href='#error'; fmgHandler.highlight_fields('" . join(',',$sErr['fields']) ."'); </script>" ;
    };

} // end of function phpfmg_form()



function phpfmg_thankyou(){
    if( defined('PHPFMG_REDIRECT') && '' != PHPFMG_REDIRECT ){
        echo "<script type='text/javascript'>
            function phpfmg_redirect(){
                var redirect = '" . addslashes(PHPFMG_REDIRECT) . "';
                try{
                    if( parent ) parent.location.href = redirect;
                }catch(e){
                    location.href = redirect;
                };
            }
            
            phpfmg_redirect();
        </script>"; 
    };
    

?>

<!-- [Your confirmation message goes here] --------------------------------->
	<br>

    <b></b>
    <br><br>

<?php

} // end of function phpfmg_thankyou()
?>[/code\]

Here is the link where the code is:

[URL unfurl="true"]http://www.everywomansnorthstar.com/registrationindividual/form.php[/URL]

Thanks for all your help!
 
fundamentally you have created a rod for your own back by using a third party application to undertake a trivial task that you could code yourself.

you should look at pfmg_choice and determine whether the line
Code:
$value = HtmlSpecialChars( $opt );

is commented out. if it is then the first solution above should work. if it is not then you will have to do some html editing.

something like this:
Code:
<?php
$cb = phpfmg_checkboxes( 'field_9', "I have read and agree to the Terms and Conditions set forth by The Missing Piece, LLC.  (Please note that without accepting these terms, we will not provide coaching services or accept your registration.)  You may read and print the conditions [link href="[URL unfurl="true"]http://www.everywomansnorthstar.com/terms.html"[/URL]]here[/url]", true );
$cb = preg_replace('/\[link (href=".*?")](.*?)[/url]/i', '<a \1>\2<\/a>', $cb);
echo $cb;
?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top