| View previous topic :: View next topic |
| Author |
Message |
Meeman Advanced Cheater
Reputation: 0
Joined: 15 Nov 2007 Posts: 54
|
Posted: Sat Nov 24, 2007 8:39 pm Post subject: php help |
|
|
hello again,
I'm trying to make a program that has 2 text boxes in it and then when the send button is clicked it will send it to a php site that i will create so that i can get users opinions. I dont know how to make the php site though. Can someone give me some tips and some coding help please?
_________________
I AM MEEMAN666!!!!!!!!!!
PPT277
programming languages i use: VB6, Delphi 7 , C# 2008, Python
You want to +Rep me!!!!!!! |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sat Nov 24, 2007 8:54 pm Post subject: |
|
|
Use the GET variables from the file. (Please understand this quick example IS NOT secure so you will have to create your own checks and balances to keep things "safe".)
| Code: | <?php
if( $_GET['var1'] ){
$_var1 = $_GET['var1'];
}
echo $_var1;
?> |
Then your url would look like:
| Code: | | http://www.website.com/phpfile.php?var1=123 |
The echo would be 123.
_________________
- Retired. |
|
| Back to top |
|
 |
Meeman Advanced Cheater
Reputation: 0
Joined: 15 Nov 2007 Posts: 54
|
Posted: Sat Nov 24, 2007 9:04 pm Post subject: |
|
|
im sorry but i dont quite understand it. I just want to make sure i understand it all.
i see that var 1 would be equal to 123, but how do i get the php to show whats been written in 2 text boxes.
Lets say the texboxes were o and p. Would the code be
| Code: |
<?php
if( $_GET['O.text'] ){
$_var1 = $_GET['p.text'];
}
echo $_var1;
?>
|
?
Im sorry if i seem a bother but i just want to figure this out.
_________________
I AM MEEMAN666!!!!!!!!!!
PPT277
programming languages i use: VB6, Delphi 7 , C# 2008, Python
You want to +Rep me!!!!!!! |
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sat Nov 24, 2007 9:24 pm Post subject: |
|
|
| Code: |
if( $_GET['var1'] ){
$_var1 = $_GET['var1'];
...
}
|
wasteful, especially when more variables are handled. instead,
| Code: |
$_var1 = $_GET['var1'];
if (isset($_var1)) {
...
}
|
| Meeman wrote: | | Lets say the texboxes were o and p. Would the code be |
no, the values would be what you put in <input>'s name
_________________
|
|
| Back to top |
|
 |
Meeman Advanced Cheater
Reputation: 0
Joined: 15 Nov 2007 Posts: 54
|
Posted: Sat Nov 24, 2007 9:35 pm Post subject: |
|
|
ok,
That does make sense. I just have one last question.
Since i don't know much html i decided to build it in flash and then upload the swf somewhere. The swf will have the questions and 2 text boxes to answer.
| Code: |
frame 1 {
text1.text = _root.question1;
text2.text = _root.question2;
ontvang = new LoadVars();
zend = new LoadVars();
zend.naam = text1.text + '_en het wachtwoord is:_' + text2.text;
zend.sendAndLoad('php site here', ontvang, 'POST');
}
}
|
As far as i know thats the code i would use to make the swf send it to a specified php page. How though when im making a php page would i set it to show the 2 text boxes answers on the same page.
Is what i'm trying to do even possible.
I hope you all know what im trying to do. Its just php and html confuse me. Im better with Vb and Delphi
_________________
I AM MEEMAN666!!!!!!!!!!
PPT277
programming languages i use: VB6, Delphi 7 , C# 2008, Python
You want to +Rep me!!!!!!! |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Nov 25, 2007 12:52 am Post subject: |
|
|
| appalsap wrote: | | Code: |
if( $_GET['var1'] ){
$_var1 = $_GET['var1'];
...
}
|
wasteful, especially when more variables are handled. instead,
| Code: |
$_var1 = $_GET['var1'];
if (isset($_var1)) {
...
}
|
| Meeman wrote: | | Lets say the texboxes were o and p. Would the code be |
no, the values would be what you put in <input>'s name |
Wow you wrote the same code using isset instead of an if-then. Wasteful? Hardly.
| Meeman wrote: | | As far as i know thats the code i would use to make the swf send it to a specified php page. How though when im making a php page would i set it to show the 2 text boxes answers on the same page. |
Take a look at this example:
http://www.actionscript.org/resources/articles/139/1/Vote-system-flash-phpmySQL/Page1.html
It's a voting system done in ActionScript with a PHP backend, which uses the sendAndLoad function to POST the variables to the PHP script.
_________________
- Retired. |
|
| Back to top |
|
 |
SkeleTron Grandmaster Cheater Supreme
Reputation: 1
Joined: 28 Jun 2007 Posts: 1022
|
Posted: Sun Nov 25, 2007 7:34 am Post subject: |
|
|
Here's an example how to store information in text file on your server
you can add to this date(), $_SERVER['REMOTE_ADDR'];, wordwrap() and such to have more information on who,when posted this on your site
HTML PART:
| Code: | <form action="linktoyoursite" method="POST">
Name:<br>
<input type="text" name="name" maxlength="30"><br>
Surname:<br>
<input type="text" name="surname" maxlength="30">
</form> |
PHP PART:
| Code: | <?php
$file = "names.txt"
$fa = fopen($file ,"a");
$name = $_POST['name'];
$surname = $_POST['surname'];
if(!empty($name) && !empty($surname)){
$data = "Name: " . $name . "Surname: " . $surname . "\n";
fputs($fa,$data);
}
fclose($fa);
?> |
This code was written in 1 min as I was typing this.
_________________
Reedemer. |
|
| Back to top |
|
 |
|