Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML HTML Basics

noob php question

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

noob php question

Postby Redd » Mon Aug 13, 2012 8:08 am

guys hey, i put this here because "basic" was in the forum title, which is the level im at

im having a problem with my code, can anyone tell me why it wont echo $address1 ?

heres my index page, its long, so i cut out some of the country options

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<FORM ACTION="mapper.php" method="GET">
<TABLE>
<TR>
  <TD>Address Line 1:</TD>
  <TD><INPUT TYPE="TEXT" NAME="addressLine1" SIZE=30></TD>
</TR>
<TR>
  <TD>Address Line 2:</TD>
  <TD><INPUT TYPE="TEXT" NAME="addressLine2" SIZE=30></TD>
</TR>
<TR>
  <TD>City:</TD>
  <TD><INPUT TYPE="TEXT" NAME="city" SIZE=30></TD>
</TR>
<TR>
  <TD>Country</TD>
  <TD>
    <select id="country" name="country">
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Anguilla">Anguilla</option>
<option value="Antarctica">Antarctica</option>

</select><br />
  </TD>
</TR>


</TABLE>

<INPUT TYPE="SUBMIT" VALUE="Map it!">
</FORM>
</body>
</html>



heres my mapper.php, with the echo thats not working. i cant figure out why

Code: Select all

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Mapper</title>
</head>

<body>


<?php

$address1 = $_GET ["addressLine1"];

$address2 = $_GET ["addressLine2"];

$city = $_GET ["city"];

$country = $_GET ["country"];


?>

Country = <?php echo $address1; ?>


</body>
</html>

Redd
New php-forum User
New php-forum User
 
Posts: 3
Joined: Mon Aug 13, 2012 8:01 am

Re: noob php question

Postby freshnet » Mon Aug 13, 2012 8:53 am

Your code looks fine to me. Try echoing the get variable itself to see if anything comes back. If it does, something is screwy in your variable assignment.
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 252
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: noob php question

Postby Redd » Mon Aug 13, 2012 1:40 pm

cheers Freshnet, many thanks for taking the time to look it over.

i knew it was something simple that i just couldnt see....

i didnt have it running through a server lol, no php was getting processed. i put it through xampp and now its returning the value no bother.

may i ask, where would the appropriate section to post this in have been, and, do you entertain novice's around here , lol. i can see more questions coming from me...
Redd
New php-forum User
New php-forum User
 
Posts: 3
Joined: Mon Aug 13, 2012 8:01 am

Re: noob php question

Postby freshnet » Tue Aug 14, 2012 2:43 am

Probably you should have put it in PHP coding => General, but yes of course we are fine with newbie questions!
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 252
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada


Return to HTML Basics

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.