0

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

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

Comments

1

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'];

Comments

0

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

6 Comments

is it mandatory that I should use a form to do this? for my requirement is :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
To my understanding, you are mixing up server-side and client-side languages. Firstly, all PHP processing occurs on the server and the ways to send data from a HTML from to a PHP server is either by using a FORM action with get/post method, or generating a URL to the PHP script with your data as GET parameters or via an AJAX call which I don't see is required in your situation.
I am not looking at AJAX. >generating a URL to the PHP script with your data as GET parameters ..I am looking at this .can you helpme how I can send data without the form. I want to call the php script on my server with one input variable from my htmkl
if your PHP script is looking for a GET parameter with name currpage, then add a hyperlink to the "next" in your page with href as "/path/to/your/file.php?currpage=5".
can you please give me an example, how to send 2 values like this:/path/to/your/file.php?currpage=5 and also how to use to GETthem\
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.