Jump to content

PHP Form Validation


bobs2007

Recommended Posts

Hi, I'm still new to PHP so this probably has an obvious answer, so could you bare with me. I have an HTML for that I'm using to post data to a PHP validation script. I was then wondering if there is a way to pass the data from the post to another script without have the user to click submit on a form?

 

Thanks for you help.

Link to comment
https://forums.phpfreaks.com/topic/46607-php-form-validation/
Share on other sites

1. You can try putting the data in the url like this

 

redirect.php?value=1&value2=2

 

but this one is a bit insecure,

 

2. you can put it in a session, since it will be saved,

  when you go to the next page.

 

session_start()
$_SESSION['value'] = 33;

 

3. or you can store it in the db, its a bit complicated though.

Link to comment
https://forums.phpfreaks.com/topic/46607-php-form-validation/#findComment-226893
Share on other sites

i'm not sure either one of those posts answers the question as how to send data from a form without requiring the user to press 'submit'. if curl can do this, i have no idea how, and i'd like an explaination =).

 

but since i don't think i can, you'd have to use a client-side scripting language... the only question left is how do you want your script to know when to send data on its own? which was the point of my original post:

how else are you planning on sending the data?

Link to comment
https://forums.phpfreaks.com/topic/46607-php-form-validation/#findComment-226902
Share on other sites

Thanks for the help.

 

I think I've posted it incorrectly, What I meant was when my user clicks submit the data is posted to a validation script. I wanted so that the validation script passes the data from the form after being checked without having to write out a form to do this and have the user push submit again. This is because I wanted to auto-redirect if the validation is all correct.

Link to comment
https://forums.phpfreaks.com/topic/46607-php-form-validation/#findComment-226910
Share on other sites

checkout my first post, it should do that,

if you have just two or three variables just use

the $_SESSION

 

page1.php

session_start()
$_SESSION['value1'] = $_POST['value1'];
$_SESSION['value2'] = $_POST['value2'];

 

page2.php

session_start();
echo $_SESSION['value1'];
echo $_SESSION['value2'];

Link to comment
https://forums.phpfreaks.com/topic/46607-php-form-validation/#findComment-226913
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.