php - How can I save information from forms? -


here code in jsfiddle: http://jsfiddle.net/mppxx/

if find way through clicking first "yes" or first image on left within div tag, come across form in speaking about.

now, after user inputs information (i include 'submit' button later), how can 'save' information? need information 2 purposes:

1) create reminder said information

2) make separate area "list of reminders" , display saved reminders

thanks

$(document).ready(function() {                              $(".appimg1").click(function() {                                  $("#app1").animate({                                      left: '250px',                                      opacity: 0                                  });                                  $("#app2").fadein("slow");                              });                          });                $(document).ready(function() {                              $(".appimg2").one('click.appimg2', function() {                                  $('.appimg1, .appimg2').unbind('click');                                  $('#app1').animate({                                      top: "0px",                                      opacity: 0                                  });                                  $("#app3").fadein("slow");                              });                          });
#app1{                              position:absolute;                              width:250px;                              height:250px;                              z-index:1;                              top:50%;                              left:50%;                              margin:-150px 0 0 -150px;                              background:white;                              box-shadow: 0 0 1px 1px #888888;                              text-align:center                          }                                        #app2{                              position:absolute;                              width:300px;                              height:300px;                              z-index:0;                              top:50%;                              left:50%;                              margin:-150px 0 0 -150px;                              background:white;                              box-shadow: 0 0 1px 1px #888888;                              text-align:center;                          }                                        #app3{                              position:absolute;                              width:300px;                              height:250px;                              z-index:8;                              top:50%;                              left:50%;                              margin:-150px 0 0 -150px;                              background:white;                              box-shadow: 0 0 1px 1px #888888;                              text-align:center;                          }                                        img.appimg1{                              -webkit-box-shadow: 0 0 1px 1px #888888;                              box-shadow:0 0 1px 1px #888888;                          }                                        img.appimg2{                              -webkit-box-shadow: 0 0 1px 1px #888888;                              box-shadow:0 0 1px 1px #888888;                          }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>      <div id="app1">                  <p><b><u><font face="timeburner" color="#66d9ff" size="6">do want make reminder?</b></u></font></p>                  <br>                  <img class="appimg1" border="0" src="yes.png" align="left" hspace=1.8%>                  <img class="appimg2" border="0" src="no.png" align="right" hspace=2%>              </div>                    <div id="app2" style="display:none">                  <form>                      name reminder: <input type="text" name="firstname"><br>                      on days reminded on: <br>                      <input type="checkbox" name="day" value="monday">monday<br>                      <input type="checkbox" name="day" value="tuesday">tuesday<br>                      <input type="checkbox" name="day" value="wednesday">wednesday<br>                      <input type="checkbox" name="day" value="thursday">thursday<br>                      <input type="checkbox" name="day" value="friday">friday<br>                      <input type="checkbox" name="day" value="saturday">saturday<br>                      <input type="checkbox" name="day" value="sunday">sunday<br>                  </form>              </div>                    <div id="app3" style="display:none">                  <p><b><u><font face="timeburner" color="66d9ff" size="6">do want check current reminders?</b></u></font></p>                  <img class="appimg1" alt="yes" border="0" src="yes.png" align="left" hspace=1.8%>                  <img class="appimg2" alt="no" border="0" src="no.png" align="right" hspace=2%>              </div>      

in order save information input forms php have 2 options. , options depending on how need deal information.

the first group of 'simple' options consist of php session variables

$_session['...'] 

while session variables stored on server specific 1 user typically within 1 visit, these variables lose information users "session" on website expires orwhen close php scripts

<?php      setcookie("user", "alex porter", time()+3600); ?> 

another option browser cookies can defined using php or javascript. information stored locally on user's browser. can configured longer custom expiration run risk of user clearing them or not allowing them , interrupting intended process.

it should mentioned each of these first 2 options, "site owner" have no access information without doing further custom scripting


the third option mentioned storing information database. the typical , knowledge commonly used , documented database system mysql. php has pre-built functionality allow scripts connect web database in order insert update select , delete data within it.

it should noted mysql require additional knowledge , other systems in place. working mysql require access mysql server - hosting solutions provide php run industry calls "lamp" stack. lamp standing linux apache mysql php - common web server configuration.

additionally once have access mysql server - have build schema database store information. meaning define "table" structure of database accept information - common tool doing phpmyadmin , found on majority of lamp hosting solutions offered majority of web hosting companies such godaddy.

this being said - relational database solutions persistent meaning store data indefinitely (until decide delete or breaks happens)

the typical process user submits form, form contains action of php script

<form action="handler.php" method="post"> <!-- form inputs , submits go here --> </form> 

this handler.php script process input data - connect database server , perform desired action. whether input data user signup or search information in database , output results via select command.

if want go mysql route no prerequisite knowledgei recommend starting here @ thorough, free tutorial series. on youtube. here bucky goes through of these processes including acquiring free mysql server, learning process not ideal live applications / development.

sorry writing book, hope helps!


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -