WordPress PHP form plugin help...

vrufusx65v

New Member
Messages
74
Reaction score
0
Points
0
I'm trying to use a WordPress form builder plugin and it says to input this line of code into the template:

PHP:
echo do_shortcode ("[jigowatt_form]");

and i'm not sure where to plug the line of code into, i basically just copied the contact form template page, renamed it and uploaded it. so i have the page template, i just don't understand PHP well enough to know where the line of code goes.

My question is: where do i place the line of code above in the page template below as the main content of the page?

Here's the entire page template to understand:

PHP:
<?php /*
Template Name: Site Request Form
*/ ?>
<?php
$status = "";
if(isset($_POST['cf_text']) ) 
{
  $email_adress_where_send = $lcp_cf_yourmail;
  require_once "scripts/class.phpmailer.php";
  $mail = new PHPMailer();
	$mail->IsMail();
	$mail->IsHTML(true);    
	$mail->CharSet  = "utf-8";
	$mail->From     = $_POST['cf_mail'];
	$mail->FromName = $_POST['cf_name'];
	$mail->WordWrap = 50;    
	$mail->Subject  =  st_option('st_cf_subject');
	$mail->Body     =  $_POST['cf_text']; //
	$mail->AddAddress( get_option('st_cf_yourmail') );
	$mail->AddReplyTo($_POST['cf_mail']);
  if(!$mail->Send()) {  // send e-mail
	$status =  st_option('st_cf_send_ko');
  }
  else
  {
	 $status =  st_option('st_cf_send_ok');
  }
}
//allows the theme to get info from the theme options page
/*global $options;
foreach ($options as $value) {
	if (lcp_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; }
	else { $$value['id'] =lcp_option( $value['id'] ); }
	 $$value['id'] = stripslashes($$value['id']); 
	}                                             */
?>
<?php
 get_header();
?>
<?php 
////////////////////////////////////////////////////////////////////////////////
// INTRO (category info)
////////////////////////////////////////////////////////////////////////////////
?>
<div id="intro_wrapper">
	<div class="intro_page">
	<h2><?php            
		 echo $post->post_title;
	?></h2>
	<div class="page_meta_box"><?php echo stripslashes(get_post_meta($post->ID, 'Description', true));?></div>
	</div><!-- END "div.intro_home" -->
</div><!-- END "div#intro_wrapper" -->
<?php 
////////////////////////////////////////////////////////////////////////////////
// END INTRO
////////////////////////////////////////////////////////////////////////////////
?>

<?php 
////////////////////////////////////////////////////////////////////////////////
// CONTENT WRAPPER
////////////////////////////////////////////////////////////////////////////////
?>
<div id="content_wrapper">
 <div class="content_shadow_right">
	<div id="content" class="content_page">

<?php
// >>>>>>>>>>>>>>>>> WIDGET SIDEBARS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	include 'sidebar.php';        // external link to showtime sidebar processor
// <<<<<<<<<<<<<<<<< END WIDGETS SIDEBARS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
?>            

		<div id="page" class="page_template_blog">


<?php 
////////////////////////////////////////////////////////////////////////////////
// CONTACT START
////////////////////////////////////////////////////////////////////////////////
if(!isset($_POST['cf_text']) ) 
{
?>

				  <?php the_post(); the_content();  ?>
				   <form class="contact_form" method="post" id="commentform" action="">
							<p><input type="text" id="cf_name" name="cf_name" /><label for="name"><?php echo st_option('st_cf_name'); ?></label></p>

							<p><input type="text" id="cf_mail" name="cf_mail" /><label for="mail"><?php echo st_option('st_cf_email'); ?></label></p>
							<p><textarea rows="10" name="cf_text" id="cf_text" cols="10"></textarea></p>

							<p><input name="submit" type="submit"  class="btn_a"  id="submit_contactform" tabindex="5" value="<?php echo get_option('st_cf_send'); ?>" /></p>
						</form>

<?php 
}
else
{
  echo $status;
}
////////////////////////////////////////////////////////////////////////////////
// CONTACT END
////////////////////////////////////////////////////////////////////////////////
?>
		</div><!-- END "div#page" -->
		<div class="clear"></div>
	</div><!-- END "div#content" -->

</div><!-- END "div.content_shadow_right" -->    
</div><!-- END "div#content_wrapper" -->
<?php 
////////////////////////////////////////////////////////////////////////////////
// END CONTENT WRAPPER
////////////////////////////////////////////////////////////////////////////////
?>


<?php
 get_footer();
?>
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
I'm afraid I don't quite get the difficulty. You should place it wherever in the HTML source you want the form to be. Just make sure it's within <?php ... ?> tags.
 
Last edited:

vrufusx65v

New Member
Messages
74
Reaction score
0
Points
0
okay, well im not well versed with PHP so im not sure where to place the line of code in the above post, i cant get much more general than that.

here's what im thinking when reading misson's post:

place the line of code:

PHP:
echo do_shortcode ("[jigowatt_form]");


into wherever you want to see HTML, so get rid of this code:

PHP:
 <?php the_post(); the_content();  ?> 
                   <form class="contact_form" method="post" id="commentform" action=""> 
                            <p><input type="text" id="cf_name" name="cf_name" /><label for="name"><?php echo st_option('st_cf_name'); ?></label></p> 

                            <p><input type="text" id="cf_mail" name="cf_mail" /><label for="mail"><?php echo st_option('st_cf_email'); ?></label></p> 
                            <p><textarea rows="10" name="cf_text" id="cf_text" cols="10"></textarea></p> 

                            <p><input name="submit" type="submit"  class="btn_a"  id="submit_contactform" tabindex="5" value="<?php echo get_option('st_cf_send'); ?>" /></p> 
                        </form>

and instead have this:

PHP:
<?php

echo do_shortcode ("[jigowatt_form]");  

?>

is this somewhat correct?

---------- Post added at 01:23 AM ---------- Previous post was at 01:16 AM ----------

nvm, i just placed the code in just like i explained it and it worked. YES! i learned more PHP!!! =]
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
It can help to think in terms of host and embedded languages (which is also useful for SQL injection). The host language is simply the primary language that's being processed. When the PHP interpreter is running, PHP is the host language and things like HTML, Javascript, CSS and SQL are embedded languages. Your question then becomes "Where amidst the embedded language statements should I put this host language statement?"

<?php switches to the host language, and ?> switches to an embedded language. You can also think of <?php ?> tags as surrounding statements in the host language (this perspective results in more readable code).


PHP treats anything outside of PHP tags as if they were in an echo statement, except for some special handling of whitespace around PHP tags (a newline is ignored when it directly follows a PHP close tag (?>)). The script:
PHP:
<select>
  <?php for ($i=0; $i<5; ++$i): ?>
    <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
  <?php endfor; ?>
</select>
is equivalent to:

PHP:
echo "<select>\n";
for ($i=0; $i<5; ++$i) {
    echo '      <option value="', $i, '">', $i, "</option>\n";
}
echo "</select>\n";
 
Last edited:
Top