Page 2 of 2

RE xrez

Posted: Wed Jun 20, 2007 10:23 am
by revocause
why not just make your input text so its in regular HTML

give it a name like: name= "my_input_textbox_blahblahblah "


Then up in header put php
to say somethin like

Code: Select all

<?php 

//set variable
$name = $_POST['my_input_textbox_blahblahblah ']; 

?>

That would convert whatever they put into the text box..into a variable of $name

you should use sessions as they're telling you though so that you can make it sorta 'sticky'
meaning you can use it on other pages. Otherwise, when you go to new page, it'll disappear.

if you ever try to use the $name variable , make sure you also use something like if(isset)
to make sure its even set first ..otherwise you get an error because page loads tries to read something that hasnt even been put in yet.

Posted: Wed Jun 20, 2007 10:47 am
by revocause
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


so if you only want to echo it to next page , 
heres a simple example  that you can look at and see whats goin on . 


firts page is straight HTML form ..blah blah 

[syntax="html"]


<HTML>
<HEAD></HEAD>

<body>

<center>
<BR><BR>



<form name="something" action="devforum2.php">
First name <BR><input type="text" name="firstname" size="20" value=""><BR><BR>
Last name <BR><input type="text" name="lastname" size="20" value=""><BR><BR>


<BR><BR>

<input type="submit" value="submit">
<br><br>


</form>
</BODY>
</HTML>

Save that as devforum.php
just because thats what i named it for this.

then the second page that all that crap gets shoveled off to.

Name this next one = devforum2.php[/syntax]

Code: Select all

<HTML>
<HEAD>

<?php 

//set variable 
$first_name = $_REQUEST['firstname']; 
$last_name = $_REQUEST['lastname']; 

?> 


</HEAD>

<body>

<center>
<BR><BR>

<?php echo "Hello" . " " .  "$first_name" . " " .  "$last_name"; ?>



</BODY>
</HTML>

put them to pages in your www root directory with a server on your computer or upload to web host server.

and whatever you put in the name boxes, hit submit. and it will magically post "hello (first name) (lastname)"
I say magically, because i sprinkled it with magic php dust that can only be found in the ancient mountains somwhere.
I would tell you where , but then little tree gnomes might try to kill you. ..so forget that part.

the stuff with periods and = "$first_name" . " " ."$last_name" etc

thats concatenating. aka= putting all that junk together like a word math function.. to make it echo out together.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Jun 20, 2007 10:53 am
by revocause
BUT... like a fat lady leaning over to get somethin tiny in a rain drain..


if you ever need those variables of first name and last name again anywhere in your site on other pages.

you have to use sessions. Sessions will store it through out the entire time that person is on your website.

so on any other page where you need to add in their name again. it will be able to automatically do it .

(refer to section 'Magic PHP ancient gnome dust' )

and dont tell them i told ya.

(looks both ways... runs off into thick foliaged forest)