This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
Its working at first but when I re-edit it since it looks messy, the result is now error, can somebody please help me.
I think i already closed the braces and scripts, i dont know what's wrong with it.
<?php
session_start();
require("functions.php");
if(!isset($_GET['id'])&&isset($_SESSION['username'])) header("Location: ?id=".getId($_SESSION['username']));
?>
<!-- HEAD -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>System of Account</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script>
<link rel="stylesheet" href="animate.css">
<link href="fonts/css/font-awesome.min.css" rel="stylesheet">
<link rel="shortcut icon" href="favicon.png">
<link href="css/animate.min.css" rel="stylesheet">
<link href="fonts/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="print" href="print.css" />
<!--<link type="text/css" rel="stylesheet" href="styles.css" />-->
<style>
body{
margin: 0 auto;
background-image:url("../clsimages/GG.jpg");
background-repeat: no-repeat;
background-size: 100% 720px;
-webkit-background-size:cover;
-moz-background-size:cover;
-o-background-size:cover;
}
.container{
width: 65%;
height:615px;
background-color: rgba(52, 73, 94, 0.3);
margin-top: 50px;
border-radius:4px;
border: 2px solid black;
}
</style>
<style>
table{
float:left;
border: 1px solid ;
}
</style>
<style>
ul {
width: 70%;
margin: auto;
}
</style>
<style>
.div{
width: 250%;
}
.form-control{
border: 2px dashed #D1C7AC;
width: 230px;
color: #1E049E;
onfocus="this.value=''
font-weight: bold;
font-size: 18px;
font-family: "Times New Roman";
}
</style>
<script>
function printDiv(divID) {
//Get the HTML of div
var divElements = document.getElementById(divID).innerHTML;
//Get the HTML of whole page
var oldPage = document.body.innerHTML;
//Reset the page's HTML with div's HTML only
document.body.innerHTML =
"<nav>" +
divElements + "</nav>";
//Print Page
window.print();
//*Restore orignal HTML
// document.body.innerHTML = oldPage;
// window.location='print.php';
}
</script>
</head>
<!-- BODY -->
<body>
<div id="container">
<?php
if(!isset($_SESSION['username']))
{
?>
</br></br></br></br></br></br></br></br></br></br>
<center>
<font color="black"> <h2 class="form-signin-heading"> Please Login <i class="fa fa-sign-in"> </i></h2> </font>
</br></br>
<form action="authenticate.php" class="form-signin" method="POST">
<div class="input-group" style="margin-left:42%">
<span class="input-group-addon" id="basic-addon1">Username:</span>
<input type="text" name="username" class="form-control" style="width:23%; height: 40px;" required><br />
</div>
</br>
<div class="input-group" style="margin-left:42%">
<span class="input-group-addon" id="basic-addon1" >Password:</span>
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="Enter Your Password" style="width:23%; height:40px;"required>
</div>
<br /> </br>
<button class="btn btn-lg btn-primary btn-block" type="submit" style="width:25%;"> Login <i class="fa fa-sign-in"> </i> </button>
</center>
</form>
<?php
if(isset($_GET["feedback"]))
echo $_GET["feedback"];
}
?>
<!-- NEXT PAGE -->
<?php
if(isset($_SESSION['username']))
{
$profileUsersData = getUsersData(mysql_real_escape_string($_GET['id']));
?>
<div id="menu">
<a class="button" href="logout.php">Logout</a>
</div>
<?php if(userExists(mysql_real_escape_string($_GET['id']))){ ?>
<!--Button print -->
<button class="btn btn-default" onclick="javascript:printDiv('printablediv')" class = "btn btn-success" ><i class="fa fa-print"> </i> <b> Print the fees</b></button>
<!-- End -->
<!--PRINT -->
<div class="" id="printablediv">
<p><img src="clsimages/STATEMENT.png"></p>
<div align="right">
<script>
var y = new Date();
var currentyear = y.getFullYear();
var nextyear= y.getFullYear() +1;
document.write("<p class='navbar-text pull-right'><font style = 'Impact' color = 'black'><h3> SY:<font color='blue'> "+ currentyear +"-"+ nextyear +" </h3></font></font></p>");
</script> </th>
</div>
<br>
<!-- Table -->
<table border='1' style='border-collapse:collapse; width:100%; border-bottom: hidden;'>
<col style='width:50%;'>
<tr>
<td>
<ul>
<p><font size='2%' face='Arial'> <b>
</br>
<?php
if(isset($_SESSION['username']))
{
$profileUsersData = getUsersData(mysql_real_escape_string($_GET['id']));
?>
<?php if(userExists(mysql_real_escape_string($_GET['id']))){ ?>
<div id="header">
<?php echo 'STUDENT NAME: '. $profileUsersData['LastName'].", ".$profileUsersData['FirstName']. " ".$profileUsersData['MiddleName'].""; ?>
</br></br>
<?php echo ' </br> LEVEL: '. $profileUsersData['Level'].""; ?>
</b>
</ul>
</td>
<td>
<ul>
<p><font size="2%" face="Arial"><b> TELEPHONE: (63 2) 834-2915
</br></br>
EMAIL: christianloveschool#yahoo.com
</p>
</b>
</ul>
</table>
<table border="1" style="border-collapse:collapse; width:100%;">
<col style="width:50%;">
<tr>
<td>
<ul>
<font size="2%" face="Arial">
<b>
<?php echo ' </br> DATE: '. $profileUsersData['TuitionDate'].""; ?>
<b>
</br>
<?php echo ' </br> TUITION FEE: '. $profileUsersData['Tuition'].""; ?>
</br> </br>
<?php echo ' </br> BOOKS: '. $profileUsersData['Books'].""; ?>
</br> </br>
<?php echo ' </br> SCHOOL/ PE UNIFORM: '. $profileUsersData['Uniform'].""; ?>
</br> </br>
<?php echo ' </br> OLD ACCOUNT: '. $profileUsersData['OldAcct'].""; ?>
</br>
</b>
</ul>
</td>
</font>
<td>
<font size="2%" face="Arial">
<ul>
<b>
<?php echo ' </br> BALANCE: '. $profileUsersData['Balance'].""; ?>
</b>
</ul>
</td>
</font>
</tr>
</table>
<?php } else echo "Invalid ID"; ?>
<?php } ?>
<!-- RULES OF PAYMENT -->
<table border="1" style="border-collapse:collapse; width:100%; border-top:hidden;">
<tr>
<td>
<font size="3%" face="Arial">
<ul>
<b><u>RULES ON PAYMENT:</u></b>
</font>
</br></br>
<font size="2%" face="Arial">
1. Tuition fee payment must be made every 5th day of the scheduled payment scheme. </br></br>
2.Payments should be made on time in order to take the exam needed. </br></br>
3. Reservations and Miscellaneous fees are non-refundable. </br></br>
4.A student who withdraws before the start of the school year shall be charged 50% on miscellaneous fee. </br></br>
5. A student who transfers or otherswise withdraws within two weeks after the beginning of classes and has already paid the
pertinent and other school fees in full may be charged to pay the whole amount of miscellaneous fees and the amount supposed tp be paid pertaining to tuition fee. </br></br>
6. A student who transfers or withdraws within two weeks after the beginning of classes and has not yet paid the pertinent
and other school fees shall be charged to pay the whole amount of miscellaneous fees in full and the amount supposed to be paid pertaining to tuition fee. </br></br>
7. A student who withdraws any time after the second week of classes, full payment of tuition and miscellaneous fees shall be charged. </br></br>
8. Discounts shall only be applied at the last payment. </br></br>
9. Any discounts granted will be forfeited if the payment is delayed. </br></br>
10. All fees should be paid in full before the end of the school year.
</font>
</br></br>
<hr></hr>
<br>
<table>
<font size="3%">
Any discount granted will be <b> forfeited </b> if the payment is delayed.
<br>
<u> <font color="red"> <b>
<br>
Bring this notice upon payment and have the Examination Permit validated from the office.
</font> </u>
</table>
</br></br>
<font color="blue" size="3%">
Contact the school if payment has been made, thank you.
</u> </font> </b>
</ul>
</table>
</td>
</tr>
</div>
</div>
</body>
</html>
The brackets of following if loops is not closed
if(isset($_SESSION['username'])){
<?php if(userExists(mysql_real_escape_string($_GET['id']))){ ?>
quote I think i already closed the braces - no you didn't.
your code contains 12 instances of { but only 10 instances of }. looks like 1 of the problems is that the brace on line 171 isn't closed, and there's probably 1 more somewhere
Related
I don't know how to modify the following code to make it upload multiple files by selecting once. By the following code I am able to upload one file at a time. Just wish to modify it as through this code not only I am uploading the file but also showing all the files uploaded, on the same page for download and delete.
<html>
<title>Brief upload</title>
<link href="globe.png" rel="shortcut icon">
<?php
date_default_timezone_set("Asia/Calcutta");
//echo date_default_timezone_get();
?>
<?php
$conn=new PDO('mysql:host=localhost; dbname=deu', 'root', '') or die(mysql_error());
if(isset($_POST['submit'])!=""){
$name=$_FILES['photo']['name'];
$size=$_FILES['photo']['size'];
$type=$_FILES['photo']['type'];
$temp=$_FILES['photo']['tmp_name'];
$date = date('Y-m-d H:i:s');
$caption1=$_POST['caption'];
$link=$_POST['link'];
move_uploaded_file($temp,"files/".$name);
$query=$conn->query("INSERT INTO upload (name,date) VALUES ('$name','$date')");
if($query){
header("location:index.php");
}
else{
die(mysql_error());
}
}
?>
<html>
<body>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="screen">
<link rel="stylesheet" type="text/css" href="css/DT_bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css"/>
</head>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" language="javascript" src="js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8" language="javascript" src="js/DT_bootstrap.js"></script>
<?php include('dbcon.php'); ?>
<style>
.table tr th{
border:#eee 1px solid;
position:relative;
#font-family:"Times New Roman", Times, serif;
font-size:12px;
text-transform:uppercase;
}
table tr td{
border:#eee 1px solid;
color:#000;
position:relative;
#font-family:"Times New Roman", Times, serif;
font-size:12px;
text-transform:uppercase;
}
#wb_Form1
{
background-color: #00BFFF;
border: 0px #000 solid;
}
#photo
{
border: 1px #A9A9A9 solid;
background-color: #00BFFF;
color: #fff;
font-family:Arial;
font-size: 20px;
}
</style>
<div class="alert alert-info">
Brief Uploading System
</div>
<table cellpadding="0" cellspacing="0" border="0" class="table table-bordered">
<tr><td><form enctype="multipart/form-data" action="" id="wb_Form1" name="form" method="post">
<!--<input type="file" name="photo[]" id="photo" multiple>-->
<input type="file" name="photo" id="photo" required="required"></td>
<td><input type="submit" class="btn btn-danger" value="SUBMIT" name="submit">
</form> <strong>SUBMIT HERE</strong></tr></td></table>
<div class="col-md-18">
<div class="container-fluid" style="margin-top:0px;">
<div class = "row">
<div class="panel panel-default">
<div class="panel-body">
<div class="table-responsive">
<form method="post" action="delete.php" >
<table cellpadding="0" cellspacing="0" border="0" class="table table-condensed" id="example">
<thead>
<tr>
<th>ID</th>
<th>FILE NAME</th>
<th>Date</th>
<th>Download</th>
<th>Remove</th>
</tr>
</thead>
<tbody>
<?php
$query=mysql_query("select * from upload ORDER BY id DESC")or die(mysql_error());
while($row=mysql_fetch_array($query)){
$id=$row['id'];
$name=$row['name'];
$date=$row['date'];
?>
<tr>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['name'] ?></td>
<td><?php echo $row['date'] ?></td>
<td>
<span class="glyphicon glyphicon-paperclip" style="font-size:20px; color:blue"></span></td>
<td>
<span class="glyphicon glyphicon-trash" style="font-size:20px; color:red"></span>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
You can upload multiple files in this way
Input field must be defined as an array i.e. images[]
It should be defined as multiple="multiple"
<input name="images[]" type="file" multiple="multiple" />
// Count # of uploaded files in array
$total = count($_FILES['images']['name']);
// Loop through each file
for( $i=0 ; $i < $total ; $i++ ) {
//Get the temp file path
$tmpFilePath = $_FILES['images']['tmp_name'][$i];
//Make sure we have a file path
if ($tmpFilePath != ""){
//Setup our new file path
$newFilePath = "./uploadFiles/" . $_FILES['images']['name'][$i];
//Upload the file into the temp dir
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
//Handle other code here
}
}
}
For more details PHP Multiple Upload
I've been learning PHP, I created an email sending script as below:
application/x-httpd-php index.php ( HTML document text )
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fake / Spoof Email Sender Online Script</title>
<style>
body {
background: #F8A434;
font-family: 'Lato',sans-serif;
color: #FDFCFB;
text-align: center;
overflow: hidden;
}
td{
padding: 5px;
}
input{
color: #222;
}
textarea {
overflow: auto;
padding: 5px;
}
button, input, select, textarea {
padding: 5px;
text-indent: 3%;
color: #222;
}
</style>
</head>
<body>
<div id="container">
<h2> Send Anonymous Email With Fake Email Sender</h2>
<form method="post">
<table>
<div class="row">
<tr>
<td>Subject:</td>
<td><input type="text" name="txt1" placeholder="Hello"></td>
</tr>
</div>
<div class="row">
<tr>
<div class="col-sm-4">
<td>From E-Mail:</td>
<td><input type="email" name="txt6" placeholder="example#gmail.com"></td>
</div>
</tr>
</div>
<div class="row">
<tr>
<div class="col-sm-4">
<td>To:</td>
<td><input type="email" name="txt3" placeholder="example#gmail.com"></td>
</div>
</tr>
</div>
<div class="row">
<tr>
<div class="col-sm-4">
<td>Your Message</td>
<td><textarea name="txt4"></textarea></td>
</div>
</tr>
</div> <div class="row">
<tr>
<div class="col-sm-4">
<td></td>
<td><input type="submit" name="send" value="Send Spoofed Email" class="btn btn-success"></td>
<tr>
<td></td>
<td><input type="reset" name="send" value="Reset" class="btn btn-success"></td>
</tr>
</div>
</tr>
</div>
</table>
</form>
</div>
<?php
if(isset($_POST['send']))
{
$name=$_POST['txt1'];
$email=$_POST['txt6'];
$query=$_POST['txt4'];
$to=$_POST['txt3'];
$msg=$query;
$subject=$name;
$header='From:'.$email;
if(mail($to,$subject,$msg,$header))
{
echo "Mail Sent";
}
}
?>
</body>
</html>
Now, how can I store the messages, which are sent by this script?
Can anyone give me a hint, or modify this code according to my requirements?
You will need to use something like this MySQL:
# Create connection
$conn = new mysqli("localhost:3306", 'root', $pass,'dbname');
# If the database won't connect
if($conn->connect_error) {
die("<mark>DB Connection failed: " . $conn->connect_error ."</mark>");}
$q = "INSERT INTO x (name,email,query,to)
VALUES ('".$_POST['txt1']."', '".$_POST['txt6']."','".$_POST['txt4']. "','".$_POST['txt3']."')";
$conn->query($q);$conn->exec($q);$conn->close();
Keep in mind that you'll either need to sanitise the variables, or use prepare statements.
This question already has answers here:
When to use single quotes, double quotes, and backticks in MySQL
(13 answers)
Closed 6 years ago.
I cannot show my post description on the view.php page.
My code is as follows
<?php include("config.php"); ?>
<?php
ob_start();
session_start();
if($_SESSION['name']!='admin'){
header('location: admin_login.php');
}
?>
<?php
if(isset($_GET['id']))
$id=$_GET['id'];
print_r($id); die;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>view post2</title>
<link href="admincss/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="admincss/admincustom.css">
</head>
<body>
<div class="full_page">
<div class="iner_page">
<h2><span style="">View all data</span></h2>
<form action="" method="post">
<table class="tbl3">
<tr>
<?php
$postid=$_GET['post_id'];
$result=(mysql_query("SELECT * from `tbl-post`(post_id) VALUES `$postid`"));
while ($row=mysql_fetch_row($result)){
}
?>
<tr>
<td><b><span style="color:#000;">Title</span></b></td>
</tr>
<tr>
<td>
<span id="view_post_title" style="font-weight: bold; font-size:18px;color:red;"><?php echo $row['post_title']; ?></span>
</td>
</tr>
<tr>
<td>
<img id="view_post_image" class="img-thumbnail" width="304" height="236" src="uplodfile/<?php echo $row['post_image']; ?>">
</td>
</tr>
<tr><td><span style="font-weight: normal; font-size:16px;color:red;">Featchered Images</span></td></tr>
<tr>
<td><span style="font-weight: bold; font-size:22px;color:#000; ">Description</span></td>
</tr>
<tr>
<td><span id="view_post_description" style="font-weight:normal; font-size:16px;font-size:19px;">
<?php echo $row['post_description']; ?>
</span></td>
</tr>
<tr>
<td><span style="font-weight: normal; font-size:22px; color:#000;">Catagory</span></td>
</tr>
<tr>
<td>
<span id="view_post_catname" style="font-weight: bold; font-size:18px;color:red;">
vkssc hvkuv futyoi ylg
</span>
</td>
</tr>
<tr>
<td><span style="font-weight: normal; font-size:18px; color:#000;">Tag</span></td>
</tr>
<tr>
<td><span id="view_post_tag" style="font-weight: bold; font-size:18px;color:red;">
huysrg ulier biurhq9r
</span></td>
</tr>
</tr>
</table>
</form>
</div>
<button name="" type="button" class="btn btn-default new_view_button" data-dismiss="modal" href="">Close</button>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
Check if variable $row is not null and contains your field by:
var_dump($row)
instead of echo.
I am trying to fetch results from Mysql database to several textboxes.
Here is my code that prints the results.
This page is called api2.php
How can I direct and print each row result into spesific texbox. in my index.php
<?php
include 'db.php';
$return_arr = array();
$fetch = mysql_query("SELECT * FROM user");
while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
$row_array['1'] = $row['name'];
$row_array['2'] = $row['name2'];
$row_array['3'] = $row['name3'];
$row_array['4'] = $row['name4'];
$row_array['5'] = $row['name5'];
array_push($return_arr,$row_array);
}
echo json_encode($return_arr);
?>
index.php needs to get the results on load from database (api.php) and disable textbox. The post part to database is ok
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="created" content="tir, 03 mar 2015 17:47:17 GMT">
<meta name="description" content="">
<meta name="keywords" content="">
<meta http-equiv="refresh" content="" >
<title>Vin lotteri</title>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="main">
<form id="myForm" action="userInfo.php" method="post">
<form method="get" id="form">
<center>
<h2>Vin lotteri</h2>
<br>
Velg nummer<br>
Skriv inn navnet ditt på di nummerene du ønsker<br>
Husk, kun 5 lodd pr. pers.<br><br>
<!-- javascript/jQuery -->
<script src="script/jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="script/my_script.js" type="text/javascript"></script>
<div id="holder"></div>
</head>
<body>
<script>
$.getJSON( "api.php", function( data ) {
$.each( data, function( key, val ) {
$('#holder').append( "<input value='" + val + "' name='" + val + "'/>");
});
});
</script>
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
</style>
<table class="tg">
<tr>
<th class="tg-031e">1</th>
<th class="tg-031e"><input type="text" name="l1" id="l1" /></th>
<th class="tg-031e">2</th>
<th class="tg-031e"><input type="text" name="l2" id="l2" /></th>
<th class="tg-031e">3</th>
<th class="tg-031e"><input type="text" name="l3" id="l3" /></th>
<th class="tg-031e">4</th>
<th class="tg-031e"><input type="text" name="l4" id="l4" /></th>
<th class="tg-031e">5</th>
<th class="tg-031e"><input type="text" name="l5" id="l5" /></th>
</tr>
</table>
<br>
<input type="submit" name="submit" id="submit" value="Neste" >
</form>
<span id="result"></span>
</div>
</div>
</body>
</html>
I have tried for days to get dta into my textbox with no luck.
As what I can see now I need a little help with one question:
I fetch from my database with this called api2.php:
<?php
//--------------------------------------------------------------------------
// 1) Connect to mysql database
//--------------------------------------------------------------------------
include 'db.php';
$return_arr = array();
$fetch = mysql_query("SELECT * FROM user");
while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
$row_array['1'] = $row['name'];
$row_array['2'] = $row['name2'];
array_push($return_arr,$row_array);
}
echo json_encode($return_arr);
?>
Then I use getJSON to get in my index.php:
<script>
$.getJSON("api2.php", function (data) {
$.each(data, function (key, value) {
$('#l1').val();
$('#l2').val();
});
});
And then I want it to appear into textbox in index.php:
<input type="text" name="l1" id="l1" />
<input type="text" name="l2" id="l2" />
I see that I have to find the right value, but I dont know how.
$('#l1').val(???);
I tought it was something like: $('#l1').val(echo "'$name'")
Try this. I tested it and it works>
HTML (this html accommodates your needs)
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="created" content="tir, 03 mar 2015 17:47:17 GMT">
<meta name="description" content="">
<meta name="keywords" content="">
<meta http-equiv="refresh" content="">
<title>Vin lotteri</title>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="main">
<form id="myForm" action="userInfo.php" method="post">
<form method="get" id="form">
<center>
<h2>Vin lotteri</h2>
<br>
Velg nummer<br>
Skriv inn navnet ditt på di nummerene du ønsker<br>
Husk, kun 5 lodd pr. pers.<br><br>
<!-- javascript/jQuery -->
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="script/my_script.js" type="text/javascript"></script>
<div id="holder"></div>
</head>
<body>
<style type="text/css">
.tg {
border-collapse: collapse;
border-spacing: 0;
}
.tg td {
font-family: Arial, sans-serif;
font-size: 14px;
padding: 10px 5px;
border-style: solid;
border-width: 1px;
overflow: hidden;
word-break: normal;
}
.tg th {
font-family: Arial, sans-serif;
font-size: 14px;
font-weight: normal;
padding: 10px 5px;
border-style: solid;
border-width: 1px;
overflow: hidden;
word-break: normal;
}
</style>
<table class="tg">
<tr>
<th class="tg-031e">1</th>
<th class="tg-031e"><input type="text" name="l1" id="l1"/></th>
<th class="tg-031e">2</th>
<th class="tg-031e"><input type="text" name="l2" id="l2"/></th>
<th class="tg-031e">3</th>
<th class="tg-031e"><input type="text" name="l3" id="l3"/></th>
<th class="tg-031e">4</th>
<th class="tg-031e"><input type="text" name="l4" id="l4"/></th>
<th class="tg-031e">5</th>
<th class="tg-031e"><input type="text" name="l5" id="l5"/></th>
</tr>
</table>
<br>
<input type="submit" name="submit" id="submit" value="Neste">
</center>
</form>
<span id="result"></span>
</div>
</div>
<script>
$.getJSON("api.php", function (data) {
$.each(data, function (key, value) {
$('#l'+(key+1)).val(value);
});
});
</script>
</body>
</html>
Note: Please DO NOT use <center></center> is deprecated. Ypou can remove them yourself, if you want to.
JSON (This is just an dummy example) This code is for prove that it works.
<?php
header('Content-Type: application/json');
echo json_encode(array('jose','leandro','pedro'));
I keep getting a
"Parse error: syntax error, unexpected ':', expecting ')' in /home/jobkill/public_html/process.php on line 8"
when processing inputs from a page that redirects here. I dont know what to fix,
Here's the code:
<?
$aff = $_GET['aff'] ;
$click_id = $_GET['click_id'] ;
$zipcode = #$_GET['zip'];
$state = #$_GET['custom_state'];
$subid = $_GET['subid'] ;
$urls = array(
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=23&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=80&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=46&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=37&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=55&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=71&zip=<?print $zipcode?>”);
$url = $urls[array_rand($urls)];
echo “<meta http-equiv=\"refresh\" content=3; url='$url'>”;
?>
<html>
<HEAD>
<LINK href="./index_files/style2.css" rel="stylesheet" type="text/css">
<STYLE>
#middlename
{
display:none;
visibility:hidden;
}
</STYLE>
<SCRIPT type="text/javascript" src="./index_files/scripts.js"></SCRIPT>
<SCRIPT type="text/javascript"
src="./index_files/functions.js"></SCRIPT>
<script language="JavaScript"
src="http://j.maxmind.com/app/geoip.js"></script>
</HEAD><BODY>
<DIV id="form_complete">
<!-- OPEN MAIN TABLE -->
<TABLE width="100%" height="850" border="0" align="center"
cellpadding="0" cellspacing="0" class="tablebg2">
<TBODY>
<TR>
<TD valign="top" align="center">
<!-- OPEN PLACEMENT TABLE -->
<table width="1010" height="500" border="0" cellspacing="0"
cellpadding="0">
<tr><td height="220" colspan="3"> </td></tr>
<tr>
<td width="51%"><div align="center"><img
src="index_files/blank.gif" border="0" width="425" height="344"
/></div></td>
<td
width="10%">  
; </td
>
<td width="39%" align="left">
<br /><br /><br />
<div id="super-container0">
<div id="wrapper">
<span style="color:#000000;font-weight:bold;font-
size:24px;color:#898;">Now Searching...</span><br /><span
style="color:#000000;font-weight:bold;font-size:32px;"><script
language="Javascript">document.write(geoip_city());</script>, <script
language="Javascript">document.write(geoip_region());</script></span>
<!-- <h2>for <span style="color:#000000;font-weight:bold">30-
34</span> Year Old <span style="color:#000000;font-
weight:bold">Male</span> Drivers</h2> -->
<div id="block"></div>
<div id="progress-bar"><img src="index_files/progress.gif"></div>
</div>
</div>
</DIV>
</td>
</tr>
<tr>
<td height="350" colspan="3"> </td>
</tr>
<tr>
<td colspan="3">
<DIV class="Privacy" style="width: 1000px; margin: 0 auto;">
<P style="font-family:Arial, Helvetica, sans-serif; font-
size:11px; margin: 0px; padding: 0px;">All personal information and
email addresses are kept confidential. By
submitting your expression of interest you are consenting to receive
telephone calls from our participating partners even if you have been
previously listed on a state or federal Do-Not-Call List.
</P><P style="width: 1000px; text-align: center; margin-top: 0px;
padding-top: 0px;"><A href="#" onclick="MM_openBrWindow
('privacy.htm','','scrollbars=yes,width=500,height=
400')" target="_blank" style="font-family:Arial, Helvetica, sans-
serif; font-size:10px; color:#03C">Privacy Policy</A></P>
</DIV></td>
</tr>
</table> <!-- CLOSE PLACEMENT TABLE -->
</TD></TR></TABLE> <!-- CLOSE MAIN TABLE -->
<DIV id="processing" style="display:none">
<br /><br /><br /><br />
<CENTER><img src="./index_files/logo2.gif" /><br /><br />
<H2>Searching for a specialist now ...<BR>Thank you for giving us an
opportunity to assist you today.</H2><STRONG>(Please do not Refresh
page as that will result in an error in the system.)</STRONG><BR>
<IMG src="./index_files/ajax-loader.gif" width="220" height="19"
alt="Processing">
</CENTER>
</DIV>
</BODY></html>
The problem in your code are the quotes.
This character:
“
Is not recognised as a quotation in PHP, you need to use
'
Or
"
Here is the updated code
<?
$aff = $_GET['aff'] ;
$click_id = $_GET['click_id'] ;
$subid = $_GET['subid'];
$zipcode = '';
if (isset($_GET['zip']) {
$zipcode = $_GET['zip'];
}
$state = '';
if (isset($_GET['custom_state']) {
$state = $_GET['custom_state'];
}
$urls = array(
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=23&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=80&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=46&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=37&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=55&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=71&zip=' . $zipcode);
$url = $urls[array_rand($urls)];
?>
<html>
<head>
<meta http-equiv="refresh" content=3; url='<? echo $url ?>'>
<link href="./index_files/style2.css" rel="stylesheet" type="text/css">
<style>
#middlename
{
display:none;
visibility:hidden;
}
</style>
<script type="text/javascript" src="./index_files/scripts.js"></script>
<script type="text/javascript" src="./index_files/functions.js"></script>
<script type="text/javascript" src="http://j.maxmind.com/app/geoip.js"></script>
</head>
<body>
<div id="form_complete">
<!-- OPEN MAIN TABLE -->
<table width="100%" height="850" border="0" align="center" cellpadding="0" cellspacing="0" class="tablebg2">
<tbody>
<tr>
<td valign="top" align="center">
<!-- OPEN PLACEMENT TABLE -->
<table width="1010" height="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="220" colspan="3"> </td>
</tr>
<tr>
<td width="51%">
<div align="center">
<img src="index_files/blank.gif" border="0" width="425" height="344" />
</div>
</td>
<td width="10%">
</td>
<td width="39%" align="left">
<br /><br /><br />
<div id="super-container0">
<div id="wrapper">
<span style="color:#000000;font-weight:bold;font-size:24px;color:#898;">Now Searching...</span><br />
<span style="color:#000000;font-weight:bold;font-size:32px;">
<script type="text/javascript">document.write(geoip_city());</script>,
<script type="text/javascript">document.write(geoip_region());</script>
</span>
<!-- <h2>for <span style="color:#000000;font-weight:bold">30-34</span> Year Old
<span style="color:#000000;font-weight:bold">Male</span> Drivers</h2> -->
<div id="block"></div>
<div id="progress-bar"><img src="index_files/progress.gif"></div>
</div>
</div>
</td>
</tr>
<tr>
<td height="350" colspan="3"> </td>
</tr>
<tr>
<td colspan="3">
<div class="Privacy" style="width: 1000px; margin: 0 auto;">
<p style="font-family:Arial, Helvetica, sans-serif; font-size:11px; margin: 0px; padding: 0px;">All personal information and
email addresses are kept confidential. By submitting your expression of interest you are consenting to receive
telephone calls from our participating partners even if you have been
previously listed on a state or federal Do-Not-Call List.</p>
<p style="width: 1000px; text-align: center; margin-top: 0px; padding-top: 0px;">Privacy Policy</p>
</div>
</td>
</tr>
</table> <!-- CLOSE PLACEMENT TABLE -->
</td>
</tr>
</tbody>
</table> <!-- CLOSE MAIN TABLE -->
</div>
<div id="processing" style="display:none">
<br /><br /><br /><br />
<center>
<img src="./index_files/logo2.gif" /><br /><br />
<H2>Searching for a specialist now ...<BR>Thank you for giving us an opportunity to assist you today.</h2>
<strong>(Please do not Refresh page as that will result in an error in the system.)</strong><br>
<img src="./index_files/ajax-loader.gif" width="220" height="19" alt="Processing">
</center>
</div>
</body>
</html>
I have also...
Fixed a couple of HTML errors, with missing closing tags or bad nesting
Rather than using error suppression in PHP (#$_GET['mightnotexist']) I have performed an isset($_GET['mightnotexist']) check
I have normalised the script tags
But I haven't...
Removed the tables being used for layout
Moved the inline styles into the stylesheet
UPDATE:
added whole code, tested and working
replace <?print $zipcode?> with $zipcode
i.e. “http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=23&zip=<?print $zipcode?>”,
into “http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=23&zip=$zipcode”,
and replace quotation marks (“”) to normal ones ("")
basically your code should look like this:
<?php
$aff = $_GET['aff'] ;
$click_id = $_GET['click_id'] ;
$zipcode = #$_GET['zip'];
$state = #$_GET['custom_state'];
$subid = $_GET['subid'] ;
$urls = array(
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=23&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=80&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=46&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=37&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=55&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=71&zip=$zipcode");
$url = $urls[array_rand($urls)];
?>
<html>
<HEAD>
<LINK href="./index_files/style2.css" rel="stylesheet" type="text/css">
<STYLE>
#middlename
{
display:none;
visibility:hidden;
}
</STYLE>
<SCRIPT type="text/javascript" src="./index_files/scripts.js"></SCRIPT>
<SCRIPT type="text/javascript"
src="./index_files/functions.js"></SCRIPT>
<script language="JavaScript"
src="http://j.maxmind.com/app/geoip.js"></script>
<meta http-equiv="refresh" content="3;url=<?php echo $url; ?>">
</HEAD><BODY>
<DIV id="form_complete">
<!-- OPEN MAIN TABLE -->
<TABLE width="100%" height="850" border="0" align="center"
cellpadding="0" cellspacing="0" class="tablebg2">
<TBODY>
<TR>
<TD valign="top" align="center">
<!-- OPEN PLACEMENT TABLE -->
<table width="1010" height="500" border="0" cellspacing="0"
cellpadding="0">
<tr><td height="220" colspan="3"> </td></tr>
<tr>
<td width="51%"><div align="center"><img
src="index_files/blank.gif" border="0" width="425" height="344"
/></div></td>
<td
width="10%">  
; </td
>
<td width="39%" align="left">
<br /><br /><br />
<div id="super-container0">
<div id="wrapper">
<span style="color:#000000;font-weight:bold;font-
size:24px;color:#898;">Now Searching...</span><br /><span
style="color:#000000;font-weight:bold;font-size:32px;"><script
language="Javascript">document.write(geoip_city());</script>, <script
language="Javascript">document.write(geoip_region());</script></span>
<!-- <h2>for <span style="color:#000000;font-weight:bold">30-
34</span> Year Old <span style="color:#000000;font-
weight:bold">Male</span> Drivers</h2> -->
<div id="block"></div>
<div id="progress-bar"><img src="index_files/progress.gif"></div>
</div>
</div>
</DIV>
</td>
</tr>
<tr>
<td height="350" colspan="3"> </td>
</tr>
<tr>
<td colspan="3">
<DIV class="Privacy" style="width: 1000px; margin: 0 auto;">
<P style="font-family:Arial, Helvetica, sans-serif; font-
size:11px; margin: 0px; padding: 0px;">All personal information and
email addresses are kept confidential. By
submitting your expression of interest you are consenting to receive
telephone calls from our participating partners even if you have been
previously listed on a state or federal Do-Not-Call List.
</P><P style="width: 1000px; text-align: center; margin-top: 0px;
padding-top: 0px;"><A href="#" onclick="MM_openBrWindow
('privacy.htm','','scrollbars=yes,width=500,height=
400')" target="_blank" style="font-family:Arial, Helvetica, sans-
serif; font-size:10px; color:#03C">Privacy Policy</A></P>
</DIV></td>
</tr>
</table> <!-- CLOSE PLACEMENT TABLE -->
</TD></TR></TABLE> <!-- CLOSE MAIN TABLE -->
<DIV id="processing" style="display:none">
<br /><br /><br /><br />
<CENTER><img src="./index_files/logo2.gif" /><br /><br />
<H2>Searching for a specialist now ...<BR>Thank you for giving us an
opportunity to assist you today.</H2><STRONG>(Please do not Refresh
page as that will result in an error in the system.)</STRONG><BR>
<IMG src="./index_files/ajax-loader.gif" width="220" height="19"
alt="Processing">
</CENTER>
</DIV>
</BODY></html>
replace "refresh" in your echo with \"refresh\"
and
<?print $zipcode?>
in array with
$zipcode
Update:
Checked your code and was able to reproduce your error. You're not using double quotes but some other obscure quotes that is not supported by PHP.
Proper double quotes are literally ". You can learn about the details in the PHP manual.
You probably made an error while copy and pasting code from somewhere else in the internet that was changing code's quote's on the fly for styling and display reason.
Take care. The other problems in your code still stand (see other answers as well).
Try
echo "<meta http-equiv=\"refresh\" content=\"3; url='$url'\">";
instead of the similar but different line in your screenshot (it's no text, so I can't quote it and highlight the places you made errors in there, so sorry 'bout that).
This does not create the syntax error you're asking about however.