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
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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.