• PHP link stuff.
    13 replies, posted
How can i, if someone entered something in a form, get that to go in a link? Like, here. This page is newthread.php then there is what i mean, stuff in the link. do=newthread&f=240 What i want to do, make a new thread. What forum? forum#240. How would i make it so if i entered in a form "Text here" it would show index.php?text=Text+here or something
USE _GET and _POST
[url]http://www.w3schools.com/php/php_get.asp[/url] [url]http://www.w3schools.com/php/php_post.asp[/url]
[QUOTE=Eleventeen;16227739]USE _GET and _POST[/QUOTE] More specifically, make a form like thiss: [html]<form name="form" method="GET"> <input type="text" name="text" /> </form>[/html] Then in the php: [php] print $_GET['text']; [/php] The input is available in $_GET['text'], and it will be passed with the URL like you said, .php?text=blahblah. Change the method in the form to POST and $_GET to $_POST if you want it to be passed in the request header (you can transfer more data this way and is a tiny bit more secure)
Also, can i make the form, and the php part run on 1 page? I am new to php so yea, i have no idea how to do this. Sort of like constantly runing thing that checks the username and password. (yes, diffrent from GET and POST)
[QUOTE=bobthe2lol;16228969]Also, can i make the form, and the php part run on 1 page? I am new to php so yea, i have no idea how to do this. Sort of like constantly runing thing that checks the username and password. (yes, diffrent from GET and POST)[/QUOTE] You can have the php and html be on one page, just make the form's action value the name of the file. I'm not quite sure what you mean by a constantly running thing that checks the data, but usually forums and sites like that use cookies or sessions to keep track of their users.
[QUOTE=bobthe2lol;16228969]Also, can i make the form, and the php part run on 1 page? I am new to php so yea, i have no idea how to do this. Sort of like constantly runing thing that checks the username and password. (yes, diffrent from GET and POST)[/QUOTE] [php] <?php if (isset($_GET["text"])) { print $_GET["text"]; } ?> <form name="form" method="GET"> <input type="text" name="text" /> </form> [/php]
[QUOTE=Sippeangelo;16240427][php] <?php if (isset($_GET["text"])) { print $_GET["text"]; } ?> <form name="form" action="this_file.php" method="GET"> <input type="text" name="text" /> </form> [/php][/QUOTE] fixed
[QUOTE=Kat of Night;16241227]fixed[/QUOTE] If you don't specify it it GETs to the current page anyway.
What i mean by constantly running is like if they enter 1 character in the box, its not right, so theres a little X or something, and when, without clicking a button, they enter the right username and password, there a little check or something. Its sorta like the runOnTick(1) in the wiremod E2 gate... (that means it runs every tick, theres also interval(10) meaning it runs every 10 miliseconds) is there something like this for PHP ?>
[QUOTE=bobthe2lol;16266143]What i mean by constantly running is like if they enter 1 character in the box, its not right, so theres a little X or something, and when, without clicking a button, they enter the right username and password, there a little check or something. Its sorta like the runOnTick(1) in the wiremod E2 gate... (that means it runs every tick, theres also interval(10) meaning it runs every 10 miliseconds) is there something like this for PHP ?>[/QUOTE] No. You need to do that in Javascript.
[QUOTE=bobthe2lol;16266143]What i mean by constantly running is like if they enter 1 character in the box, its not right, so theres a little X or something, and when, without clicking a button, they enter the right username and password, there a little check or something. Its sorta like the runOnTick(1) in the wiremod E2 gate... (that means it runs every tick, theres also interval(10) meaning it runs every 10 miliseconds) is there something like this for PHP ?>[/QUOTE] Your looking for ajax. I recommend [url="http://jquery.com"]JQuery[/url].
No, raw ajax is fine for that.
[QUOTE=Overv;16271920]No, raw ajax is fine for that.[/QUOTE] JQuery helps a shitload, at least for me, and there's really no downside to using it.
Sorry, you need to Log In to post a reply to this thread.