PHP form handler

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MPie
Forum Newbie
Posts: 4
Joined: Mon Jun 06, 2016 6:38 am

PHP form handler

Post by MPie »

Any ideas how I can do this?

I have a widget in Wordpress that pulls in information statically on an HTML page. However, I want to allow someone to make their own choice by searching. So I want to change THISVALUE using a textbox and submit button, which then refreshes the data on the same Wordpress page:

<h1>Search 1</h1>
<form method="post" action="handler.php">
<input type="text" name="data">
<input type="submit">
</form>

<div class="sm" data-type="static" data-symbol="THISVALUE" data-size="medium" data-logscale="on" data-chart-type="ca" data-timeframe="1y"></div>

<div class="sm" data-type="news" data-symbol="THISVALUE"></div>


Than I want this too (changes several datafields :

<h1>Search 2</h1>
<form method="post" action="handler.php">
<input type="text" name="TY">
<input type="text" name="SY">
<input type="text" name="FI">
<input type="submit">
</form>


<div class="sm-w" data-type="TY" data-symbol="SY"> <div class="sm-d" data-property="FI"></div>


PHP Handler code:

<?php
// Remain on the page and keep data that you searched for for the next time you visit.

echo $_POST["data"] ;
echo $_POST["TY"] ;
echo $_POST["SY"] ;
echo $_POST["FI"] ;

?>

Also: You press Search button and it refreshes the page with the new data values. Search 1 remains if Search 2 if press and vice versa. These values stay for the next visit to the page or until another search is performed.
Post Reply