Vmi90 Posted November 25, 2006 Share Posted November 25, 2006 Ok, ive been reading php guide after guide, but i cant figure this out...I want to make it so you type in something to be the variable. Almost like a search engine would have it, but whatever you type in, thats the variable. Also, if anyone could quickly explain how variables and arrays work in english please, i dont understand ??? Link to comment https://forums.phpfreaks.com/topic/28451-variables-and-array-help-please/ Share on other sites More sharing options...
fert Posted November 25, 2006 Share Posted November 25, 2006 variables store valuesarrays are bundles of variblesin the below example foo is a variable and bar is an array[code]$foo=5;bar[0]=6;bar[1]="hello";bar[2]=5;[/code] Link to comment https://forums.phpfreaks.com/topic/28451-variables-and-array-help-please/#findComment-130194 Share on other sites More sharing options...
AV1611 Posted November 25, 2006 Share Posted November 25, 2006 If I understand, this is what you are asking:If you use this page, it will say Name and have a box to enter your name, then a Send button.when you fill it out it will send this to the browser:./send.php?name=John<form method="GET" action="send.php">Name:<input name="name" type="text" size="30" class="box"><input type="submit" value="Send"></form>Next you have to do something with it:send.php<?php$MyVariable=$_GET['name'];echo $MyVariable;?>Now you took an input from one web page and made a $var out of it on another page.Hope it's what you wanted... Link to comment https://forums.phpfreaks.com/topic/28451-variables-and-array-help-please/#findComment-130195 Share on other sites More sharing options...
AV1611 Posted November 25, 2006 Share Posted November 25, 2006 A Variable contains an object$MyVariable="Hello";echo $MyVariable;would render HelloIn Simple terms, an Array is like a Variable but hold many items:$MyVariable[0]="Apple";$MyVariable[1]="Orange";$MyVariable[2]="Pear";$MyVariable[D]="Donut";$MyVariable contains Apple, Orange, and Pear.I Can call up one like this:echo $MyVariable[1];would render Orangewhereas echo $MyVariable[D];would renderDonutThere are a lot of variations of arrays... It takes time to learn and understand them all. Link to comment https://forums.phpfreaks.com/topic/28451-variables-and-array-help-please/#findComment-130200 Share on other sites More sharing options...
Vmi90 Posted November 25, 2006 Author Share Posted November 25, 2006 [quote author=AV1611 link=topic=116281.msg473710#msg473710 date=1164483651]If I understand, this is what you are asking:If you use this page, it will say Name and have a box to enter your name, then a Send button.when you fill it out it will send this to the browser:./send.php?name=John<form method="GET" action="send.php">Name:<input name="name" type="text" size="30" class="box"><input type="submit" value="Send"></form>Next you have to do something with it:send.php<?php$MyVariable=$_GET['name'];echo $MyVariable;?>Now you took an input from one web page and made a $var out of it on another page.Hope it's what you wanted...[/quote]Thats exactly what i wanted, but now that i have the box, whenever i send it, i dont want it to send me off that page. I just want it so when you type it in, it becomes a variable please :) Link to comment https://forums.phpfreaks.com/topic/28451-variables-and-array-help-please/#findComment-130204 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.