Jump to content

Really Basic Php Scripting Question


TOWebstress
 Share

Recommended Posts

This should be a simple question for anyone with an understanding of php, but the answer is eluding me... ;)

 

I am installing SMePoll, which is a really simple script for polling on a Web site. I'm all set up with it. The poll appears on a page called vote.php.

 

I want to place this poll on my index page. So how do I include the script located in a file called vote.php on my index page?

 

Obviously my index page needs to be a .php page. I do know that much :)

 

What line of php code do I use on my index page to call up vote.php and insert the content (i.e. polling box) into that place on my index page?

 

Any help would be appreciated!! :tchrocks:

Link to comment
Share on other sites

Hello TOWebstress,

what you would need to do is use a include statement like this one

You would copy this line into your index.php file where you want the poll to appear.

Change where it says YOUR_PATH to the location of your vote file

if it is in a folder under the public_html folder

if not simple remove the YOUR_PATH/ from the line and you should be good to go

 

><?php include $_SERVER['DOCUMENT_ROOT']."YOUR_PATH/vote.php"; ?>

 

 

let us know if you need help

 

RobertM

Link to comment
Share on other sites

Wow, you're fast! Thank you very much Robert!

 

I wasn't too far off in my attempts, actually. Your code did successfully link it, but I'm still having problems. The vote.php is dependent upon a couple other files (ip.txt and data.txt) and it can't seem to find those. It gives me lines of error that say:

 

Warning: file(ip.txt): failed to open stream: No such file or directory in /home/[myaccountname]/public_html/poll2/vote.php on line 35

 

Warning: Invalid argument supplied for foreach() in /home/[myaccountname]/public_html/poll2/vote.php on line 37

 

Warning: file(data.txt): failed to open stream: No such file or directory in /home/[myaccountname]/public_html/poll2/vote.php on line 67

 

Would it matter that the index page that I'm going to put this on is in a secured section of my site? That is, the index page is password-protected, but the polling script pages are not.

 

Thank you very much again!!!

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

 Share

×
×
  • Create New...