Kishore Thota
Kishore Thota

Reputation: 87

php script getting called from a html

I want to create a HTML file. I want that HTML file to take some input variables and call a php script?

can you please help me with a snipp of this? or any url that has this as a simple example.

I have a HTML file, when the I click "next", I want to call the php script. That php script the page it is in (say 5th page) so when I click "next", it should take the $currpage=5 (variable) and send it to the php script

Upvotes: 0

Views: 95

Answers (3)

dev_musings
dev_musings

Reputation: 1181

Create a FORM in your HTML and add some INPUT elements with a SUBMIT button. The "action" attribute of the form should contain the path for your PHP script on a server configured to run PHP. Check out this very basic tutorial from Tizag

Upvotes: 0

Marc B
Marc B

Reputation: 360702

This is utterly bog-standard beginning PHP/HTML, and you could've found it anywhere on the web if you'd just googled for "PHP introduction"

html file:

<html>

<body>

<form method="post" action="yourscript.php">
<input type="text" name="mytextfield">
<input type="submit">
</form>

</body>

</html>

PHP script:

<?php
    echo "You entered: ", $_POST['mytextfield'];

Upvotes: 1

Jesse Bunch
Jesse Bunch

Reputation: 6679

See the official PHP tutorial (specifically "Your first PHP-enabled page" and "Dealing with Forms") for all you're wanting to do here:

http://php.net/manual/en/tutorial.php

Upvotes: 1

Related Questions