开发者

how to set the values of the forms and make it stick even after refresh?

I have a long form, wherein, when I click the submit button the external js validation fires up and checks the validity of the input fields. If all the input fields passed the validation a jquery modal pops out asking the user to register or login.

Now, if the user choses to register and finishes registering from the modal, the modal closes and the page refreshes automatically and shows the user is automatically logged-in.

My problem now is that the input data from the long form he filled in before the registration got erased when the page refreshed.

How can I make input fields not erase on refresh of a page? Is it possible to set the session within the external js file ? If yes, how can I to that?

For example:

$_SESSION['resumetitle'] = $_POST['resu开发者_如何学Cmetitle'];
$_SESSION['resumeintro'] = $_POST['resumeintro'];
$_SESSION['name'] = $_POST['name'];
$_SESSION['dob'] = $_POST['dob'];
$_SESSION['contacttel1'] = $_POST['contacttel1'];
$_SESSION['contacttel1type'] = $_POST['contacttel1type'];
$_SESSION['contacttel2'] = $_POST['contacttel2'];
$_SESSION['contacttel2type'] = $_POST['contacttel2type'];
$_SESSION['contacttel3'] = $_POST['contacttel3'];
$_SESSION['contacttel3type'] = $_POST['contacttel3type'];
$_SESSION['primaryemail'] = $_POST['primaryemail'];
$_SESSION['secondaryemail'] = $_POST['secondaryemail'];
$_SESSION['skype'] = $_POST['skype'];
$_SESSION['facebook'] = $_POST['facebook'];
$_SESSION['linkedin'] = $_POST['linkedin'];
$_SESSOIN['twitter'] = $_POST['twitter'];
$_SESSION['messenger'] = $_POST['messenger'];
$_SESSION['yahoo'] = $_POST['yahoo'];
$_SESSION['aol'] = $_POST['aol'];
$_SESSION['summaryofpositionsought'] = $_POST['summaryofpositionsought'];
$_SESSION['summaryofskills'] = $_POST['summaryofskills'];
$_SESSION['gender'] = $_POST['gender'];


One way to do this is sending an XMLHTTPRequest to one of your pages along with session variable names and values, and that would set it. There may be better ways to do this.


Simply reassign your Post vars to the form elements. in elements value add

<?php $_POST['resumetitle'];?> 

this should work fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜