sam
sam

Reputation: 57

php call back script

I am trying to make a callback function for my website. I have seen a few PHP scripts but I am having trouble linking the script to the input text boxes. My PHP script is called callback.php. This is my HTML code:

<form action="callback.php" method="post" accept-charset="utf-8">

        <label id="Name"><br><br><br><br>Name<br> 
            <input name="nameinput" type="text" style="width: 300px; height: 30px;" /> </label>

        <label id="Email"><br><br>Email Address<br> 
            <input name="emailinput" type="text" style="width: 300px; height: 30px;" />  </label>

        <label id="Number"><br><br>Phone Number<br> 
            <input name="numberinput" type="text" style="width: 300px; height: 30px;" />  </label>

        <label id="Subject"><br><br>Subject<br> 
            <input name="subjectinput" type="text" style="width: 300px; height: 30px;" /> </label>

        <label id="Question"><br><br>Question<br> 
            <input name="questioninput" type="text" style="width: 300px; height: 70px" />
            <br><br> </label>

        <input name="Submit" type="submit" value="submit" />

        </form>

I have my form and I have tried using other PHP scripts and when I click the submit button on the form it acts as if it is a download. Does the script have to be on a .php page or can I incorporate it into the HTML and put it above the form?

Upvotes: 0

Views: 1391

Answers (1)

UnholyRanger
UnholyRanger

Reputation: 1971

If the page is being treated as a download, this means the server does not know how to serve the file. This may mean you don't have PHP installed or Apache may not be setup properly.

PHP can be in any file extension you want but Apache will need to know to process that extension with the PHP engine. For example (in .htaccess):

AddType application/x-httpd-php .html

This tells Apache to run the .html extension files with the PHP engine. The suggested way is to use mod_rewrite if you want the .html extension to show and keep PHP files with the .php extension.

HTML code can be mixed in with PHP code. I suggest reading up on the basics of PHP.

Upvotes: 1

Related Questions