Login | Register | FAQ
Anonymous

lesson 11:Problem passing form variables

+ Post a reply

18 posts 1, 2


Re: lesson 11:Problem passing form variables

by erok » Thu Apr 12, 2012 2:45 am

Hi everyone, here are my html and php files;<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>boat maintenance</title>
<link rel="stylesheet" type="text/css" href="lay.css" />
</head>
<body>
<div class="container">
<div class="header"> <img src="bn12.jpeg" alt="neptune" height="225" width="100%">
<h1>Yacht Management Company</h1>
</div>
<div class="content">
<ul class="b">
<li><a href="index11.html">Home</a></li>
<li><a href="boatcare4.html">Maintenance</a></li>
<li><a href="#">Yatch Detailing</a></li>
<li><a href="#">Provisioning</a></li>
</ul>
<br>
<br>
<h2>Boat Maintenance</h2>
<p>Boat detailing is the one of the main parts of extending boat' life
span. Boat deck detailing focus on</p>
<ul class="c">
<li><b>boat stainless steel (crome)</b></li>
<li><b>boat wood work</b></li>
<li><b>boat paint</b></li>
</ul>
<p>Painting is not for just cosmatic reason to make the boat looks
good. This is only part of the reason.
Paint functions more than boat looks pretty. Paint actually encapsulate
the <b>fiberglass</b>, <b>wooden</b>, <b>steel</b> or <b>aluminum</b>
structure and seals the structure from <b>sun ray</b>, <b>o2</b> and <b>salt</b>,
and these are the main reason of boat' deterioration
other than <b>lightening</b> and <b>vibrations</b> which are overall
negative effects on boats. </p>
<p>Titanium dioxide, the substance that makes white paint bright and adds blocking power to most sunscreens, has another remarkable property it's a photocatalyst. In the presence of moisture and the sun's ultraviolete light, titanium dioxide nanoparticules catalyze or break down some of the water to produce oxygen radicals that is oxygen atom with extra electrons, which are very effective in destroying organic materials like dirt , bacteria, oil and other occuring contaminants. Fabrics or other surfaces treated or manufactured with titanium dioxide nanoparticules exhibit antibacterial properties and can improve air quality.</p>
<div class="contact">
<p>Always feel free to stay in touch with us. We will be glad to hear from you</p>

<form method="post" action="test4.php" >
First name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:<input type="text" name="firstname" ><br>
Last name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:<input type="text" name="lastname" ><br>
Phone number:<input type="text" name="phone" ><br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="Submit" />
</form>

<p>" or "</p>
<a href="mailto:yalnizyildiz@hotmail.com">e-mail to Erol</a><br>
<br>
<address> theboatcare.com <br />
Address:&nbsp;&nbsp;&nbsp;Post Box 123, Fort Lauderdale,
FL<br>
Phone&nbsp;&nbsp;&nbsp;:&nbsp; 954 321 1234 </address>
<!-- JAVASCRIPTS -->
<script type="text/javascript">
var d = new Date() var time = d.getHours()
if (time>=24 && time<10) {
document.write("Hello visitor thanks for
stopping by have a good morning!");
}
else if (time>=10 && time<12) {
document.write("Hello visitor thanks for
stopping by have a good day!");
}
else if (time>=12 && time<16) {
document.write("Hello visitor thanks for stopping by have a good afternoon!");
}
else if (time>=16 && time<20) {
document.write("Hello visitor thanks for stopping by have a good evening!");
}
else if (time>=20 && time<24) {
document.write("Hello visitor thanks for stopping by have a good night!");
}
<!-- document.write("<p>" + Date() + "</p>"); -->
</script><br>
<br>
<a style="color: black;" href="boatcare4.html"><b>==&gt;Page2</b></a>
<br />
<br />
<br />
</div>
<br />
<div class="comment"> Comment
<form method="post" action="test4.php" >
<textarea type="text" name="message" rows="8" col="20"></textarea>
<br>
<input type="submit" value="Submit" >
<br>
</form>
</div>
</div>
<div class="rightside"> <img id="pic2" src="teak.jpg" alt="boat" align="right" height="120" width="150" />
<p id="absol">Deck teak cleaning is
periodically done on
boats.
Air pollution, salt and sun ray deteriorate the deck teak. There are
many different teak cleaning products available on the market. These
products unfortunatelly are not good for the teak in the long term.</p>
<br>
<p id="absolu"><img id="pic2" src="polish.jpg" alt="boat" align="right" height="120" width="150" />
Boat detailing goes well with right products.
If you use wrong product you might end up ruining your project so
always
you should stick with proper product. You will find right products in
our website. Do not concern about where you can find these products.We are here to take care of these troubles for you. That is our job.</p>
<img id="pic2" src="cleaning.jpg" alt="boat" align="right" height="120" width="150" />
<p>Since many of the more professional products require refined methods and special techniques that simply can not be explained on the back of a box. This is where experience involve in.
When you hire a company with employees who know what they do, your boat will smile.
<p>Washing down the boat is one of the periodically done maintenence effort. Prevent water spots and streaks needs extra care which is done with proper shamying thoroughly your boat. Our crew are well trained to handle this task properly.
</p>
</div>
<div class="footer">
<br />
<p> Copyright by 2012 © UsA DataErol Inc.</p>
<br />
</div>
</div>
</body>
</html>

//**PHP FILE **//

<html>
<head>
<title>test4</title>
</head>
<body>

<?php
if(isset($_POST['firstname']) && $_POST['firstname'] != "" ){
$firstname = $_POST['firstname'];
}

if(isset($_POST['lastname']) && $_POST['lastname'] != "" ){
$lastname = $_POST['lastname'];
}

if(isset($_POST['phone']) && $_POST['phone'] != "" ){
$phone = $_POST['phone'];
}

$strHeading = "<h4>Hello $firstname $lastname!</h4> ";
echo "<h3>Visitor Information Page</h3>";
echo $strHeading;
echo "your phone number is " ;
echo $phone ;
echo " which is kept confidential";

if(isset($_POST['message']) && $_POST['message'] !="" ){
$message = $_POST['message'];
}

echo "<h3>Visitor Suggestion Page</h3>";
echo $message ;

?>

</body>
</html>

**P.S.**
Java script is not working proper. I did not have time to work on it yet.
**P.S.**
Just ignore the second form and submit. I need to work on it also.
**P.S.**
I did not upload the boatcare4.html and lay.css. I do not think they are important for this topic.
take care
User avatar

erok

  • Posts: 11
  • Joined: Fri Apr 06, 2012 3:44 pm

Re: lesson 11:Problem passing form variables

by XainPro » Thu Apr 12, 2012 4:06 am

erok,
thanks for your informative and nice sharing.
XainPro
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: lesson 11:Problem passing form variables

by XainPro » Sun Apr 15, 2012 4:14 am

nice sharing CubeSquare.
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: lesson 11:Problem passing form variables

by erok » Sun Apr 15, 2012 10:01 pm

You can see now my website at
"www.erol.comlu.com"
It is free web hosting from 000webhost.com
User avatar

erok

  • Posts: 11
  • Joined: Fri Apr 06, 2012 3:44 pm

Re: lesson 11:Problem passing form variables

by XainPro » Fri Apr 20, 2012 4:42 am

Sorry CubeSquare i need to ask what's ymc ?
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: lesson 11:Problem passing form variables

by XainPro » Fri Apr 20, 2012 10:02 am

ohh lol ok
actully when i read the word YMC i thought its some kind of new technology i am not aware of
like
CSS,
PHP,
ASP,
etc lolz.
Thanks for your Kind Information.
XainPro
User avatar

XainPro

  • Posts: 3933
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: lesson 11:Problem passing form variables

by erok » Mon Apr 23, 2012 2:20 pm

"the index.html, even though it validated, it didn't work in IE, Chrome or Safari without a graphic glitch. Either way, it's OK. I think the author is not listening anyway."

Hi cubesquare,

Thank you very much for your efforts. I don't want to use e-mail program at the moment. But i keep it for future reference. I don not know what you mean with the index.html did not work without a graphic glitch. Website is working fine in IE and firefox.
User avatar

erok

  • Posts: 11
  • Joined: Fri Apr 06, 2012 3:44 pm

Re: lesson 11:Problem passing form variables

by erok » Tue Apr 24, 2012 8:41 pm

Hi people,
I am trying to transfer data from the website to webhost's myadmin db
It is not working. I could not make it out. I do not know exactly i am missing.

my html file look like this;

<form method="post" action="ekle.php" >
<input type="text" name="antispam" style="display: none;" /><br />
First name:<input type="text" name="firstname" maxlenght="50" id="f1" /><br />
Last name:<input type="text" name="lastname" maxlenght="50" id="f2" /><br />
Phone number:<input type="text" name="phone" maxlenght="30" id="f3" /><br />
<p> <b>Comment</b></p>
<textarea type="text" name="message" maxlenght="100" id="f4" rows="12" col="40"></textarea>
<br>
<input type="submit" name="formsubmit" value="Submit" class="button" />
</form>

my php file look like this;

<html>
<head>
<title>select data from database</title>
</head>
<body>
<?php
//connect to database server
$con = mysql_connect("*******", "******", "******") ;
if (!$con)
{
die('could not connect: ' .mysql_error());
}
// select database
mysql_select_db("*****", $con);

if(isset($_POST['antispam']) && $_POST['antispam'] != "" ){
$antispam = ($_POST['antispam']);
$error_status = false;
}
if(isset($_POST['firstname']) && $_POST['firstname'] != "" ){
$firstname = ($_POST['firstname']);
$error_status = false;
}

if(isset($_POST['lastname']) && $_POST['lastname'] != "" ){
$lastname = ($_POST['lastname']);
$error_status = false;
}

if(isset($_POST['phone']) && $_POST['phone'] != "" ){
$phone = ($_POST['phone']);
$error_status = false;
}

if(isset($_POST['message']) && $_POST['message'] != "" ){
$message = ($_POST['message']);
$error_status = false;
}

//sql statement is built
if($error_status == false) {
mysql_query("INSERT INTO employees(firstname, lastname, phone, message)
VALUES
('$firstname' , '$lastname' , '$phone' , '$message')";
}
else {
echo "we need you to fill out the form fields completely";
}
//close the database connection
mysql_close($con);
?>
</body>
</html>
help realy appreciated
User avatar

erok

  • Posts: 11
  • Joined: Fri Apr 06, 2012 3:44 pm


+ Post a reply

1, 2