Login | Register | FAQ
Anonymous

lesson 11:Problem passing form variables

+ Post a reply

1, 2


lesson 11:Problem passing form variables

by erok » Fri Apr 06, 2012 5:10 pm

I have xampp 1.7.3 in windows 7.
Question is; Why can my html page not find php file and my php file not process my html file?
My HTML page's form section as follow;

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

<html>
<body>
<p>This is posting page</p>
welcome <?php echo $_POST["firstname"]; ?>!<br />
your phone number is <?php echo $_POST["phone"]; ?>
<?php echo "Hello Guest"; ?>
</body>
</html>
In my html page, i entered the data in the form section and when i try to pass variables to my php file,
i got message as follow;
{Internet Explorer can not display the webpage. Press button(diagnose connection problems)
Windows can not find "file:///C:users/Erol/Documents/test4.php" //**which is actually in localhost/test4.php**//
The website you are trying to reach does not appear to be valid.}

When i go to localhost/test4.php. The message as follow;

This is posting page
welcome !
your phone number is Hello Guest.

Is there anybody out there to help me how to connect my html page and php page? Appreciated
User avatar

erok

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

Re: lesson 11:Problem passing form variables

by erok » Sat Apr 07, 2012 1:11 am

I switched the test4.php to handler.php same problem. Nothing changed
User avatar

erok

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

Re: lesson 11:Problem passing form variables

by erok » Sat Apr 07, 2012 3:52 pm

You are not paying attention to the question first follow the question carefully.
Before writing you need to learn to read.Obviously i am wasting my time in here.
User avatar

erok

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

Re: lesson 11:Problem passing form variables

by HTML.net » Sat Apr 07, 2012 4:13 pm

This tone is not acceptable in the forums! You got a warning. People are trying to help you.

- Andreas, HTML.net
User avatar

HTML.net
Site Admin

  • Posts: 1184
  • Joined: Sat Sep 11, 2010 11:24 am
--
Show some love for HTML.net on Twitter, Facebook and Google: Use the buttons on top of all pages.

Re: lesson 11:Problem passing form variables

by XainPro » Sun Apr 08, 2012 12:55 pm

erok,
1st of all place your html file and test4.php file in the same folder.
2nd both should in in your htdocs folder of xampp directory.
3rd the error you are saying is trying to get file from local computer and bypass xampp's apache.
4th You should use your browser and open http://localhost/ to check your pages i think you are trying dreamweaver view option or browser option or directly opening your html file from directory.
5th BEEEEEE COOOOOOOL programing is not for the persons you get irritated so soon.
sometime i lost my whole day finding bug in my code and at the end of day i only file the comma(,) mistake :P
Hope This Help.
User avatar

XainPro

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

Re: lesson 11:Problem passing form variables

by erok » Sun Apr 08, 2012 5:03 pm

Yes, first i did not place both html and php files in htdocs. I put both files in xampp htdocs later.I initialized variables.Still not working, no connection between files.
in htdocs when i opened index.php file i got message as follow;
//////*
<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/xampp/');
exit;
?>
Something is wrong with the XAMPP installation :-( *///////

I uninstall xampp 1.7.3 and reinstall again xampp 1.7.3
I got the same message again.
I might install xampp 1.7.1 instead. To see what happens.
User avatar

erok

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

Re: lesson 11:Problem passing form variables

by erok » Sun Apr 08, 2012 10:18 pm

Hi cubesquare thank you for your effort;
I did as you said
All Programs =>
xampp for windows=>
xampp control panel
xampp set up
xampp shell (administrator:xampp for windows )
xampp uninstall
**There is no htdocs** //**Maybe this is the problem i don't know **//

Actually i have no problem to place my files in htdocs
These are the files in htdocs, as follow;

C:\xampp\htdocs\

index11.html //** my offline website index page **//
test4.php //** my php page **//
blue2.jpeg
bn10.jpg
bn12.jpeg
boatcare4.html
index.html
index.php
sea.jpg
teak.jpg
xampp
lay.css //** my css file for website **//
So all my files in the same place in htdocs

When i type in url C:\xampp\htdocs\index11.html
I am in my website. After filling the form click "submit" button,
A page comes ''Internet Explorer can not display the webpage'' On the same page URL looks like this;
C:\Users\\Erol\Documents\test4.php //** actually my "test4.php" file in C:\xampp\htdocs\ **\\
Somehow does not go to htdocs and find test4.php in there.In html <form method="post" action="test4.php" >

When i type in url http://localhost/index11.html
I am in my website.After filling the form clicks "submit" button,
NO RESPONSE AT ALL. URL does not change.

When i type in url http://localhost/test4.php
A page comes says Hello! your phone number is //** partially process **//

I don't know why two files in the same folder in htdocs do not recognize each other.
I don't know what is wrong
User avatar

erok

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

Re: lesson 11:Problem passing form variables

by erok » Mon Apr 09, 2012 4:30 am

Hi Everyone,
Finally I found out what it is giving me hard time for days.
It is just a joke of notepad ++.
Notepad++ add to my index11.html page's head section following code without my knowledge;
///**
<base href="file:///C:/Users/Erol/Documents/index11.html">
<style xml:base="/C:/Users/Erol/Documents/" type="text/css" id="webdeveloper-edit-css-style-0">
**///

I do not know when, why and how it added that code to my html page.
I deleted them.
Now my php file is running smoothly.
Thank you guys for your help
User avatar

erok

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

Re: lesson 11:Problem passing form variables

by XainPro » Mon Apr 09, 2012 5:33 am

erok,
what i understand by this is you are trying to run your files without placing in htdocs and opening files directly.
but at last you solved your problem i am glad you did it :)
Regards,
Xain Pro
User avatar

XainPro

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

Re: lesson 11:Problem passing form variables

by erok » Mon Apr 09, 2012 1:11 pm

I run my files in htdocs
User avatar

erok

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


+ Post a reply

1, 2