Forms in PHP not displaying - php

Using this exact code I've been able to create text fields in HTML, but when I convert (rename) the file to PHP the field dissapears. Why does this happen and how do I stop it?
Code:
<!DOCTYPE html>
<html>
<head>
<title>StatsCalc V1</title>
<link rel="stylesheet" type="text/css" href="Buttons.css">
<link rel="icon" type="image/png" href="favicon.ico">
<link href='http://fonts.googleapis.com/css?family=Raleway:500' rel='stylesheet' type='text/css'>
</head>
<body>
<form>
<input type="text" class="writies" name="writy1" />
</form>
</body>
</html>

make a new file index.php write in it the bellow code and if it shows something you have php installed if not you don't have.
To have php installed you either install manually apache + php or you download a ready made application like xampp or ampps or easyphp which will provide you with everything you need to begin learning php.
tutorial for install of course you can choose any other.
<?php
phpinfo();

Related

How to access css file in laravel 8? [duplicate]

This question already has answers here:
Where to put css file in laravel project
(6 answers)
Closed 2 years ago.
I have been trying to access it like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
</head>
<body>
<div class="red">
#yield('content')
</div>
</body>
</html>
I put the background red in the css file but nothing is changing. Any help is appreciated
You need to install laravel mix. As it is added in the package.json in fresh installation of laravel, follow below steps:
run npm install to install package that are added in package.json more
add mix.css('resource/css/app.css', 'css'); to the webpack.mix.js file more
run npm run dev to compile files that are addressed in webpack.mix.js more
link to your app.css as {{ asset('css/app.css') }} in the desired blade file.
Notice: You need to run npm run dev after any changes that you make in the resource/css/app.css file. Or benefit from npm run watch which complies automatically after any changes.
Notice: Press ctrl+f5 to clear cache after every change or use cache busting
put it in public/css and use it like this:
<link rel="stylesheet" href="{{ asset('/css/app.css') }}">
clear your browser cache, and make sure that directory of CSS file was public/css

Laravel "Echo is not defined" when not run on server from command "php artisan serve"

My laravel application now running on Apache ,
I deployed it by copy 'public' folder from laravel project folder and paste in htdocs inside apache root folder.
Everything work fine.
I am implementing Echo by following this https://laravel.com/docs/5.5/broadcasting#installing-laravel-echo
There is not error and work perfectly when testing on serve from command
php artisan serve
(On port 8000)
But when i access file form port 80 it show this error on browser's console
(I haven't change anything)
Uncaught ReferenceError: Echo is not defined
Here is the containing error file.
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>Clean Gem Service</title>
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="{{ asset('js/jquery.js') }}"></script>
</head>
<body>
<div id="app-notification"></div>
<script src="{{ asset('js/app.js') }}"></script>
<script>
Echo.private('NewOrderChannel')
.listen('NewOrderEvent', (e) => {
console.log(e);
});
</script>
</body>
</html>
How this happened?
Am i deployed my app in wrong way? And how to fix it
Thanks.
Did you make Echo available?
"Once Echo is installed, you are ready to create a fresh Echo instance in your application's JavaScript. A great place to do this is at the bottom of the resources/assets/js/bootstrap.js file that is included with the Laravel framework"
(https://laravel.com/docs/5.5/broadcasting#installing-laravel-echo)
If so, it looks like you need to use window.Echo

Bootstrap with composer

I've downloaded bootstrapp with composer
composer.json
{
"name": "afern/seocom_login",
"require": {
"twbs/bootstrap": "3.3.7"
}
}
and I've included the autoload file on index.php
<?php
include "./vendor/autoload.php";
?>
<html>
<head>
</head>
<body>
<h2>Hello</h2>
</body>
</html>
Bootstrap its downloaded on vendor folder but it's not working I guess I also have to add this line to the html code
<link rel="stylesheet" href=".vendor\twbs\bootstrap\bootstrap.min.css">
Am I right? or there is any way to work bootstrap only with
include "./vendor/autoload.php"
Composer is for managing your PHP dependencies, which appears to be your backend technology of choice. However, a UI framework, such as Bootstrap, is a frontend dependency (CSS and JS).
Your proposed way of referencing the CSS in your HTML is the way to go:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
Same for jQuery and the Bootstrap JS:
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
It's probably easiest for you if you embed it from a CDN as in my examples. If you want to serve the files yourself you could use bower to manage your frontend dependencies (although I think that is discontinued).
Your composer auto load script, however, is not what you need for this.

php echo is not working in html

I am having some trouble getting a php value into a bootstrap button which is in html
This is my code:
<html>
<head>
<title>Samples</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</head>
<body>
<?php echo "Samples"; ?> Stuff
</body>
</html>
So instead of the button saying "Samples Stuff" - the button just simple says "Stuff". It is important that the button takes a php value as eventually I will be putting a db value in the button - but I can't even get the basics working
Why is it not working?
Are you running a locally hosted server. If not, you probably should install XAMPP. Ensure the file has a .php extension, I don't see any other reason why a simple echo would not work.
Make sure that the file extension ends with .php. Also make sure that your php/apache is configured correctly.
Try and look at your error logs and see if anything is there
Firstly ensure that your file extension is .php secondly make sure you run .php files on a php enabled webserver. Simply viewing php files on your browser will not actually compile the php. This is done in the back-end on your server.

Symfony "Welcome page" seems incomplete

I thought I have Symfony all up and running ok on the VM machine I've been trying to set up. However after following the instructions on this link:
http://symfony.com/doc/current/book/installation.html#configuration-and-setup
I'm not getting reassuring 'welcome' page in the screenshot. Instead, I just see an empty page with 'Homepage.' written in the corner. The underlying HTML is:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Welcome!</title>
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
Homepage.
<div id="sfwdtc2fded" class="sf-toolbar" style="display: none"></div>
<script>
/* [editor's note: the JS code of the toolbar has been removed] */
</script>
</body>
</html>
I get exactly the same whether I go to: http://localhost/app.php or http://localhost/app_dev.php
Does anyone know what could be causing this? The link http://localhost:8000/config.php works perfectly and I have no errors there (just one recommendation to install INTL extension but I don't suppose that's the problem).
You've probably installed Symfony 2.6, which had an AppBundle delivering your this page. You can comment the line registering the AppBundle in app/AppKernel.php to see the demo homepage.
I had the same problem and solved it by running
composer require symfony/framework-bundle
and it seems to have solved me problem.

Categories