Jump to content

Where to insert the php script


prcollin

Recommended Posts

I am adding forms and a search engine into my website.

 

I have created to form for the search engine (The search input field) now do i put the php script after the html code then close it and then open another php script in order to run separate processes on same page

 

<html>

 

Search html Content

 

<$php

 

PHP Content

 

$></html>

 

 

<html>

 

Form Content

 

<$php

 

PHP Content

 

$></html>

 

 

 

Should it look something generally like that or can i keep the php tag open until the very end.

 

Link to comment
Share on other sites

First off it is <?php not <$php

 

<?php
// search content and php content, just put them in a string
?>
<html>
<?php echo $search_content; ?>

Form Content

<?php echo $form_content; ?>
</html>

 

I find it better to put output into variable and then echo them where you need them exactly in the code. This can save some heartache later on with session, headers and cookies.

Link to comment
Share on other sites

so for form content it would be the html format and the search would be the php code for the search bar correct?

 

First off it is <?php not <$php

 

<?php
// search content and php content, just put them in a string
?>
<html>
<?php echo $search_content; ?>

Form Content

<?php echo $form_content; ?>
</html>

 

I find it better to put output into variable and then echo them where you need them exactly in the code. This can save some heartache later on with session, headers and cookies.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.