Can it be done?
TIA.
Printable View
Can it be done?
TIA.
Yes...
Set your form up: <form action="page.php" method="post">
and get the form stuff like:
Or just do a search of these forums or read the manual: http://www.php.net/Code:echo $_REQUEST['field_name'];
submitting/reading forms is rather elementary.
NO, if you do it you will be the 1st EVER to do it in php. you better write a book :rolleyes: :pQuote:
Originally posted by Dodger
Can it be done?
TIA.
Sorry, I was in a bit of a hurry before.
Here's something basic:
Basically all there is to it.Code://let's call this bung.php
if (isset($_REQUEST['submit'])) {
//the form was sent:
echo "What's up, " . $_REQUEST['name'] . "?!";
} else {
echo '<form action="bung.php" method="post">
<input type="text" name="name"><br>
<input type="submit" value=" Submit ">
</form>';
}
The Hobo,
You saying the form will be automatically submitted just by echoing it?
no, to submit it you have to push on the submit button.
just like a html form no different
I found a script at PSC that can do it through code. ;)
and how is that? you have to click on something. what would the purpose to submitting the form is if the user doesn't get a chance to insert the info?
What phpman said. After you submit the form, the values that were in that form are stored in what is referred to as "super globals." Like $_REQUEST, $_POST, and $_GET, depending on how you setup the form. $_REQUEST holds both $_POST and $_GET variables, and a few others.Quote:
Originally posted by Dodger
The Hobo,
You saying the form will be automatically submitted just by echoing it?
So once you submit the form, you have to check in your php file to see if it was submitted, and act accordingly. If the form has been submitted, these global variables are available for use in the php program for that time.
What I showed you is doing it through code. Do you not see the code? :rolleyes:Quote:
Originally posted by Dodger
I found a script at PSC that can do it through code. ;)
My best bet is that he found some JavaScript code and is confusing it with PHP...Quote:
Originally posted by phpman
and how is that? you have to click on something. what would the purpose to submitting the form is if the user doesn't get a chance to insert the info?
Hey, don't be rude...lol
I'm new to PHP...not that new!
The script I found takes the URL and an associative array containing the input values, opens a socket connection and posts a request to the server.
ok see, they have to push submit to get the input values to go anywhere.
what you are doing is the long way around and harder.
... :confused:Quote:
Originally posted by Dodger
Hey, don't be rude...lol
I'm new to PHP...not that new!
The script I found takes the URL and an associative array containing the input values, opens a socket connection and posts a request to the server.
What does this have to do with submitting a form?
"opens a socket connection and posts a request to the server"
Did you, by chance when you posted this thread, ask the wrong question or neglect to elaborate on your question?
The Hobo,
No I didn't, I was asking for code to simulate a form submission.
D.
You asked if it was possible to submit a form in PHP.Quote:
Originally posted by Dodger
The Hobo,
No I didn't, I was asking for code to simulate a form submission.
D.
Yes. Hit the submit button...
*sigh*
I have a 'quick register' form at my site, I am simply looping through a member database and submitting the form for each member.
D.
That makes no sense...Quote:
Originally posted by Dodger
*sigh*
I have a 'quick register' form at my site, I am simply looping through a member database and submitting the form for each member.
D.
Why don't you just do it in code? Are you creating a form, putting the values in the fields, and simulating a submit?
Again, that makes no sense.
you didn't say anything about a simulation?
The registration script is not made by myself, it has various functions, it's not a simple sql insert. It's possible to include the registration page and call the register function, but I think the script expects values in the $_POST variables.
well yeah, you could have teh form submtted by the user and then in the php check script you can send variabels to the function
so the scruipt that simulates a submit, does it expects a return answer, becasue that is pretty much what teh socket connection is doing.
still don't make any sense to what you are doing.
yes the script does ask for ther result of the request.
so how are you sending the form info?
I'm just not understanding what he's doing and why he's doing it, so I'll leave this thread up to you, phpman.
me?? I don't understand either :p
lol, don't worry guys, I'll try some other way.
Thanks.
I think I know what you're trying to do. Correct me if I'm wrong..
You have a database with users or something like that in there. You want to submit the data from each of these records to another form. To do this you want to "fake" the submission of a form (ie open a web page and supply the form values without requiring a form to be displayed and clicking on the submit button)
Am I right??
I know how to do this in Visual Basic - you can use the WebBrowser control to open a page and specify optional headers (Eg the form values in the POST header.) As for doing it in PHP..? I have no idea.
Why not just modify the script to read the entries from the database and process them one by one within that same script. Would be easier in the long run I think.
Matt
if you understood that then you get the booby prize :p LOL
I still don't know what he wants.
That's it, Matt.
I ended up adding the records to the db directly once I figured out which fields were required.
Thx.