I have a form in php that has 2 textareas, this form uses ckeditor in those textareas
When send it, i receive the changes of the first textarea and the data of the second textarea without changes
The html code is:
<!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></title>
<link href="../css/estilo.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../scripts/prototype.js"></script>
<script type="text/javascript" src="../scripts/dropdown_menu.js"></script>
<script type="text/javascript" src="../scripts/funciones.js"></script>
<script type="text/javascript" src="scripts/funciones.js"></script>
<script type="text/javascript" src="../../ckeditor/ckeditor.js"></script>
</head>
<body >
<div id="container">
<div id="head"></div>
<div id="menucontainer">
<ul id="menu">
<li><a id="Actualizaciones" href="../noticias/noticias.php" title="ACTUALIZACIONES" >ACTUALIZACIONES</a>
</li>
<li><a id="Correo" href="../correos/correos.php" title="CORREOS" >BOLETÍN DE NOTICIAS</a>
</li>
<li><a id="Salir" href="../usuarios/logout.php" title="SALIR" >SALIR</a>
</li>
</ul>
</div>
<div id="submenucontainer">
</div>
<script type="text/javascript">
<!--
var menu = new DropDownMenu($('menu'));
-->
</script>
<div id="menuizq">
<ul class="sec">
<li >Cambiar Contraseña
</li>
<li >Salir
</li>
</ul>
</div>
<div id="administracion">
<div id="titulo">Actualizaciones</div>
<form action="" method="post" name="form1" id="form1" target="_self" enctype="multipart/form-data" >
<div >
<div class="fm-fila " >
<div class="fm-campo" >
Titulo:<br /><input name="txt_titulo" type="text" id="txt_titulo" autocomplete="off" maxlength="60" value="Trazabilidad por Productos" tabindex="1" onKeyPress="return tabular(event,this)" class="input_pre" />
</div>
<div class="fm-campo5" >
Fecha:<br /><input name="txt_fecha" type="text" id="txt_fecha" autocomplete="off" maxlength="10" value="20/08/2013" tabindex="2" onKeyPress="return tabular(event,this)" class="input_pre" />
</div>
<div class="fm-icon" >
<img src="../img/icons/date.png" width="16" height="16" align="top" onclick="displayCalendar($('txt_fecha'),'dd/mm/yyyy',this);" style="cursor:pointer" />
</div>
</div>
<div class="fm-fila " >
<div class="fm-campo2" >
Entradilla:<br />
<textarea name="txt_entradilla" id="txt_entradilla" tabindex="3" class="ckeditor" rows="8"/>prueba 1</textarea>
</div>
</div>
<div class="fm-fila " >
<div class="fm-campo2" >
Detalle:<br />
<textarea name="txt_detalle" id="txt_detalle" tabindex="4" class="ckeditor" rows="8"/>prueba 2</textarea>
</div>
</div>
<div class="fm-fila " >
<div class="fm-campo2" style="text-align:center;">
</div>
</div>
<div class="fm-botonera" >
<input type="button" name="guardar" id="guardar" class="bto-guardar" tabindex="5" value="Guardar" onclick="javascript:validar()" style="margin:6px 0px;"/>
<input type="button" name="cancelar" id="cancelar" class="bto-cancelar" tabindex="6" value="Cancelar" onclick="location.href='noticias.php'" style="margin:6px 0px;"/>
<input type="hidden" name="txt_id" id="txt_id" value="32" />
</div>
</div>
</form>
</div>
</div>
</body>
</html>
The php code is:
<?php
echo $_POST['txt_entradilla'];
echo $_POST['txt_detalle'];
?>
If I take out the first textarea the second sends the changes and if I place first textarea "B" and then the textarea "A", the textarea "A" don’t have the changes.
I'm using CKeditor 4.2.
i upload my files to mediafire, here is the link: http://www.mediafire.com/?x73h2sjq8ku63ih
Related
This question already has answers here:
PHP mail function doesn't complete sending of e-mail
(31 answers)
Closed 4 years ago.
I'm having an issue with my html form sending to my email.
I have it set up so that it goes to a php file and it works fine, but when I change the filename from index.php to contact.php it doesn't send anymore.
contact.php:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style/stylesheet.css">
<script src="script/scripts.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
</head>
<body>
<div class="banner">
<img src="images/banner.jpg">
</div>
<div class="navigation">
<div class="navbar">
Home
News
<div class="dropdown">
<button class="dropbtn">Parts
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Cases
Motherboards
Processors
Graphics Cards
Storage
Power Supplies
RAM
Other
</div>
</div>
<div class="dropdown">
<button class="dropbtn">Builds
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
Placeholder
Placeholder
Placeholder
Placeholder
Placeholder
Placeholder
Placeholder
Placeholder
</div>
</div>
<div class="contact" id="navright">
Contact
</div>
</div>
</div>
<div class="contact_page">
<form class="contact_form" action="contactform.php" method="post">
<label>Full Name:</label><br/>
<input type="text" name="name" placeholder="Full Name"><br/>
<label>Your Email:</label><br/>
<input type="text" name="mail" placeholder="Email"><br/>
<label>Subject:</label><br/>
<input type="text" name="subject" placeholder="Subject"><br/>
<label>Message:</label><br/>
<textarea name="message" class="contacttext" placeholder="Message..."></textarea><br/>
<button class="submit" type="submit">Submit</button>
</form>
</div>
<div class="footer">
<div class="footertext">
<p>Here at Terry's Computers we do not claim to own any of
the products showed on this website.</p>
<p>Contact Us</p>
</div>
</div>
</body>
</html>
contactform.php:
<?php
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$subject = $_POST['subject'];
$mailFrom = $_POST['mail'];
$message = $_POST['message'];
$mailTo = "terryjtowell#terrytowell.com";
$headers = "From: ".$mailFrom;
$txt = "You have received an Email from ".$name.".\n\n".$message;
mail($mailTo, $subject, $txt, $headers);
header("Location: contact.php?mailsend");
}
?>
It's not my web hoster because it worked with this file.
index.php:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<meta charset="UTF-8">
<title>Email Form</title>
</head>
<body>
<main>
<p class="header">E-MAIL FORM</p>
<form class="contact-form" action="contactform.php" method="post">
<p class="title">Your Name</p>
<input type="text" name="name" placeholer="Full Name"><br/>
<p class="title">Your E-Mail</p>
<input type="text" name="mail" placeholer="Your E-mail"><br/>
<p class="title">Subject</p>
<input type="text" name="subject" placeholer="Subject"><br/>
<p class="title">Message</p>
<textarea name="message" maxrows="10" placeholder="Message"></textarea><br/>
<button type="submit" name="submit"><h2>SUBMIT</h2></button><br/>
</form>
</main>
</body>
</html>
Your PHP line:
if (isset($_POST['submit'])) {
Will never execute because you need an element with the name of submit, but you have:
<button class="submit" type="submit">Submit</button>
Which you have in the example you say works. The solution should be as simple as adding a name attribute like this:
<button class="submit" name="submit" type="submit">Submit</button>
I used Tecite for my contact form and am trying to get my form to work but it is coming up with an error message every time that is saying:
"An errr occurred while processing the form."
The staff... and it goes on as a generic error message.
Im not sure what I am missing in my code but would love some help!!
I have posted my code below, one being the contact.html and the other the formmail php code.
php form
---contact.html---
Haus of Originals
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="Haus of Originals Website">
<link href="css/style_contact.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="images/h_favicon2.png">
<!-- Script -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<!-- Responsive and mobile friendly stuff -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Haus of Originals
</div>
<div class="button_container" id="toggle">
<span class="top"></span>
<span class="middle"></span>
<span class="bottom"></span>
</div>
<div class="overlay" id="overlay">
<nav class="overlay-menu">
<ul>
<li><a class="one" href="home.html" title="Home">Home</a></li>
<li><a class="one" href="about.html" title="About">About</a></li>
<li><a class="one active" href="contact.html" title="Contact">Contact</a></li>
</ul>
</nav>
</div>
<!-- Header Gif -->
<div class="section banner">
<h4>
We are building brands that we want to be apart of, welcome home. </h4>
</div>
<!-- Header Gif End -->
<div class="section group">
<img src="images/rtt.jpg" alt="walllogo">
</div>
<div class="section group three">
<div class="column span_1_of_2">
<h5>Contact</h5>
<h6> Haus of Originals<br>
28 Intrepid Drive <br>
Bozeman, Montana 59718
<br>
<br>
651.470.6511<br>
406.459.5954
<br> <br>
<a class="three" href="mailto:info#hausoforiginals.com">info#hausoforiginals.com</a>
</h6>
</div>
<div class="column span_2_of_2">
</div>
</div>
<div class="section group four">
<section class="contact-wrap">
<!--Form Action Needs to point to where you have uploaded the formail.php file-->
<form method="post" action="http://www.hausoforiginals.com/formmail/formmail.php" name="ContactForm" class="contact-form">
<!-- Keep this line it's base settings to check and send the form -->
<input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER" />
<!-- This sets where the email is sent to -->
<input type="hidden" name="recipients" value="info#hausoforiginals.com" />
<!-- This sets the fields to be required. -->
<input type="hidden" name="required" value="EmailAddress:Your email address,FirstName:Your name,Message: Your message" />
<div class="col-sm-6">
<div class="input-block">
<label for="FirstName">First Name</label>
<input type="text" name="FirstName" class="form-control">
</div>
</div>
<div class="col-sm-12">
<div class="input-block">
<label for="EmailAddress">Email</label>
<input type="email" name="EmailAddress" class="form-control">
</div>
</div>
<div class="col-sm-12">
<div class="input-block">
<label for="MessageSubject">Subject</label>
<input type="text" name="MessageSubject" class="form-control">
</div>
</div>
<div class="col-sm-12">
<div class="input-block textarea">
<label for="Message">Spit it Out</label>
<textarea rows="3" name="Message" class="form-control"></textarea>
</div>
</div>
<div class="col-sm-12">
<input type="submit" value="Submit" class="square-button">Send It
</div>
</form>
</section>
</div>
<div class="section group two">
<div class="col spanfooter_1_of_3">
<img class="logoone" src="images/h_logo_hp.jpg" alt="logo">
</div>
<div class="col spanfooter_2_of_3">
<h2>Handles </h2>
<p>Instagram</p>
<p>Twitter </p>
<p>Facebook </p>
<b>back to top</b>
</div>
<div class="col spanfooter_3_of_3">
<h2>Get in Touch</h2>
<p> 651.470.6511 <b>|</b> 406.459.5954 </p><br>
<a class="two" href="mailto:info#hausoforiginals.com"><b>info#hausoforiginals.com</b></a>
<br>
<p>
2017 © All Rights Reserved
</p>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$(window).bind('scroll', function() {
checkScrollPos();
});
checkScrollPos();
$('.toTopLink').bind('click', function() {
$('html, body').animate({
scrollTop: 0
}, $(window).scrollTop() / 3);
return false;
});
});
function checkScrollPos() {
if ($(window).scrollTop() > 600) {
$('.toTopLink').fadeIn(1000);
} else {
$('.toTopLink').fadeOut(1000);
}
}
$(document).ready(function() {
//material contact form
$('.contact-form').find('.form-control').each(function() {
var targetItem = $(this).parent();
if ($(this).val()) {
$(targetItem).find('label').css({
'top': '10px',
'fontSize': '14px'
});
}
})
$('.contact-form').find('.form-control').focus(function() {
$(this).parent('.input-block').addClass('focus');
$(this).parent().find('label').animate({
'top': '10px',
'fontSize': '14px'
}, 300);
})
$('.contact-form').find('.form-control').blur(function() {
if ($(this).val().length == 0) {
$(this).parent('.input-block').removeClass('focus');
$(this).parent().find('label').animate({
'top': '25px',
'fontSize': '18px'
}, 300);
}
})
});
$('#toggle').click(function() {
$(this).toggleClass('active');
$('#overlay').toggleClass('open');
});
</script>
I am new to php, i have an affiliate script, in the add campaign page when i fill the form and submit the form it says "Campaign Added" but the form data was not saved in database,
My Add Campaign Form
<?php
session_start();
if(isset($_SESSION['myadminusername']))
{
$myusername = $_SESSION['myadminusername'];
include '../config.php';
header( 'Content-Type: text/html; charset=utf-8' );
}
else
{
echo"<script type='text/javascript'>
window.location.href='login.php';
</script>";
}
if( isset($_POST['text']) )
{
mysql_query("Insert into link values ('', '".addslashes($_POST['text'])."', '".addslashes($_POST['caption'])."', '".addslashes($_POST['description'])."', '".$_POST['img']."', '".$_POST['site_us_pc']."', '".$_POST['site_oth_pc']."', '".$_POST['site_us_mob']."', '".$_POST['site_oth_mob']."', '".$_POST['status']."', '".$_POST['catname']."', '".$_POST['us_cpc']."', '".$_POST['uk_cpc']."', '".$_POST['au_cpc']."', '".$_POST['in_cpc']."', '".$_POST['oth_cpc']."', '".$_POST['pak_cpc']."', '".$_POST['star']."', '0')");
echo"<script type='text/javascript'>
alert('Campaign Added');
</script>";
}
?>
<!doctype html>
<!--[if lte IE 9]> <html class="lte-ie9" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Remove Tap Highlight on Windows Phone IE -->
<meta name="msapplication-tap-highlight" content="no"/>
<link rel="icon" type="image/png" href="assets/img/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="assets/img/favicon-32x32.png" sizes="32x32">
<title>Altair Admin v2.0.0</title>
<!-- uikit -->
<link rel="stylesheet" href="bower_components/uikit/css/uikit.almost-flat.min.css" media="all">
<!-- flag icons -->
<link rel="stylesheet" href="assets/icons/flags/flags.min.css" media="all">
<!-- altair admin -->
<link rel="stylesheet" href="assets/css/main.min.css" media="all">
<!-- matchMedia polyfill for testing media queries in JS -->
<!--[if lte IE 9]>
<script type="text/javascript" src="bower_components/matchMedia/matchMedia.js"></script>
<script type="text/javascript" src="bower_components/matchMedia/matchMedia.addListener.js"></script>
<![endif]-->
</head>
<?php include 'head.php'; ?>
<div id="page_content">
<div id="page_content_inner">
<h3 class="heading_b uk-margin-bottom">Blank Page</h3>
<div class="md-card">
<div class="md-card-content">
<div class="uk-grid" data-uk-grid-margin>
<div class="uk-width-1-1">
<form method="post" action="campaign_add.php">
<div class="form-group">
<label>Campaign Title</label>
<input class="md-input" name="text" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Suggested Caption</label>
<input class="md-input" name="caption" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Campaign Image Link</label>
<input class="md-input" name="img" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Campaign Description</label>
<input class="md-input" name="description" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Campaign US PC Link</label>
<input class="md-input" name="site_us_pc" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Campaign Other PC Link</label>
<input class="md-input" name="site_oth_pc" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Campaign US Mob Link</label>
<input class="md-input" name="site_us_mob" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Campaign Other Mob link</label>
<input class="md-input" name="site_oth_mob" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Campaign Status</label>
<select name="status">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
</div>
<br>
<br>
<div class="form-group">
<label>Campaign Category</label>
<select name="catname">
<?php
$results = mysql_query("Select * from link_cat");
while ($row = mysql_fetch_array($results))
{
echo'<option value="'.$row['id'].'">'.$row['catname'].'</option>';
}
?>
</select>
</div>
<br>
<br>
<div class="form-group">
<label>US Pay per click (INR)</label>
<input class="md-input" name="us_cpc" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>UK Pay per click (INR)</label>
<input class="md-input" name="uk_cpc" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Australia Pay per click (INR)</label>
<input class="md-input" name="au_cpc" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>India Pay per click (INR)</label>
<input class="md-input" name="in+cpc" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Pakistan Pay per click (INR)</label>
<input class="md-input" name="pak_cpc" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Other Pay per click (INR)</label>
<input class="md-input" name="oth_cpc" type="text">
</div>
<br>
<br>
<div class="form-group">
<label>Star</label>
<select name="star">
<option value="false">No</option>
<option value="true">Yes</option>
</select>
</div>
<br>
<br>
<div class="form-group">
<input class="md-btn md-btn-primary" value="Add" type="submit">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- google web fonts -->
<script>
WebFontConfig = {
google: {
families: [
'Source+Code+Pro:400,700:latin',
'Roboto:400,300,500,700,400italic:latin'
]
}
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
</script>
<!-- common functions -->
<script src="assets/js/common.min.js"></script>
<!-- uikit functions -->
<script src="assets/js/uikit_custom.min.js"></script>
<!-- altair common functions/helpers -->
<script src="assets/js/altair_admin_common.min.js"></script>
<script>
$(function() {
// enable hires images
altair_helpers.retina_images();
// fastClick (touch devices)
if(Modernizr.touch) {
FastClick.attach(document.body);
}
});
</script>
<div id="style_switcher">
<div id="style_switcher_toggle"><i class="material-icons"></i></div>
<div class="uk-margin-medium-bottom">
<h4 class="heading_c uk-margin-bottom">Colors</h4>
<ul class="switcher_app_themes" id="theme_switcher">
<li class="app_style_default active_theme" data-app-theme="">
<span class="app_color_main"></span>
<span class="app_color_accent"></span>
</li>
<li class="switcher_theme_a" data-app-theme="app_theme_a">
<span class="app_color_main"></span>
<span class="app_color_accent"></span>
</li>
<li class="switcher_theme_b" data-app-theme="app_theme_b">
<span class="app_color_main"></span>
<span class="app_color_accent"></span>
</li>
<li class="switcher_theme_c" data-app-theme="app_theme_c">
<span class="app_color_main"></span>
<span class="app_color_accent"></span>
</li>
<li class="switcher_theme_d" data-app-theme="app_theme_d">
<span class="app_color_main"></span>
<span class="app_color_accent"></span>
</li>
<li class="switcher_theme_e" data-app-theme="app_theme_e">
<span class="app_color_main"></span>
<span class="app_color_accent"></span>
</li>
<li class="switcher_theme_f" data-app-theme="app_theme_f">
<span class="app_color_main"></span>
<span class="app_color_accent"></span>
</li>
<li class="switcher_theme_g" data-app-theme="app_theme_g">
<span class="app_color_main"></span>
<span class="app_color_accent"></span>
</li>
</ul>
</div>
<div class="uk-visible-large">
<h4 class="heading_c">Sidebar</h4>
<p>
<input type="checkbox" name="style_sidebar_mini" id="style_sidebar_mini" data-md-icheck />
<label for="style_sidebar_mini" class="inline-label">Mini Sidebar</label>
</p>
</div>
</div>
<script>
$(function() {
var $switcher = $('#style_switcher'),
$switcher_toggle = $('#style_switcher_toggle'),
$theme_switcher = $('#theme_switcher'),
$mini_sidebar_toggle = $('#style_sidebar_mini');
$switcher_toggle.click(function(e) {
e.preventDefault();
$switcher.toggleClass('switcher_active');
});
$theme_switcher.children('li').click(function(e) {
e.preventDefault();
var $this = $(this),
this_theme = $this.attr('data-app-theme');
$theme_switcher.children('li').removeClass('active_theme');
$(this).addClass('active_theme');
$('body')
.removeClass('app_theme_a app_theme_b app_theme_c app_theme_d app_theme_e app_theme_f app_theme_g')
.addClass(this_theme);
if(this_theme == '') {
localStorage.removeItem('altair_theme');
} else {
localStorage.setItem("altair_theme", this_theme);
}
});
// change input's state to checked if mini sidebar is active
if((localStorage.getItem("altair_sidebar_mini") !== null && localStorage.getItem("altair_sidebar_mini") == '1') || $('body').hasClass('sidebar_mini')) {
$mini_sidebar_toggle.iCheck('check');
}
// toggle mini sidebar
$mini_sidebar_toggle
.on('ifChecked', function(event){
$switcher.removeClass('switcher_active');
localStorage.setItem("altair_sidebar_mini", '1');
location.reload(true);
})
.on('ifUnchecked', function(event){
$switcher.removeClass('switcher_active');
localStorage.removeItem('altair_sidebar_mini');
location.reload(true);
});
// hide style switcher
$document.on('click keyup', function(e) {
if( $switcher.hasClass('switcher_active') ) {
if (
( !$(e.target).closest($switcher).length )
|| ( e.keyCode == 27 )
) {
$switcher.removeClass('switcher_active');
}
}
});
if(localStorage.getItem("altair_theme") !== null) {
$theme_switcher.children('li[data-app-theme='+localStorage.getItem("altair_theme")+']').click();
}
});
</script></body>
</html>
Database Table Column List screen short
You have to change:
<input class="md-input" name="in+cpc" type="text">
to:
<input class="md-input" name="in_cpc" type="text">
and to check the return value:
if(isset($_POST['text']))
{
$returnValue = mysql_query("Insert into link
values ('',
'".addslashes($_POST['text'])."',
'".addslashes($_POST['caption'])."',
'".addslashes($_POST['description'])."',
'".$_POST['img']."',
'".$_POST['site_us_pc']."',
'".$_POST['site_oth_pc']."',
'".$_POST['site_us_mob']."',
'".$_POST['site_oth_mob']."',
'".$_POST['status']."',
'".$_POST['catname']."',
'".$_POST['us_cpc']."',
'".$_POST['uk_cpc']."',
'".$_POST['au_cpc']."',
'".$_POST['in_cpc']."',
'".$_POST['oth_cpc']."',
'".$_POST['pak_cpc']."',
'".$_POST['star']."',
'0')");
if ($returnValue === FALSE) $message = 'Failure: '.mysql_error();
else $message = 'Campaign Added';
echo"<script type='text/javascript'>
alert('$message');
</script>";
}
I cannot garantee I found all errors. You might find my layout a bit strange, but I can read this much better.
NOTE: The mysql extension of PHP is depricated, and never insert user input directly in a query.
there are two forms one is registration form and another is sign in form .When am registring with registration form its div element is fetching message from php using isset funtion but when i am doing same thing with sign in it is redirecting page to homepage please help what can i do if am trying to match database if not matched it will fetch value from php and show in the div as in the code
<?php
if (!empty($_POST['finish'])) {
//do something here;
include'php/signup.php';
}
if (!empty($_POST['go'])) {
include'php/signin.php';
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/homepage.css">
<link rel="stylesheet" type="text/css" href="css/login.css">
<link rel="stylesheet" type="text/css" href="css/signup.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/login.js"></script>
<script src="js/signup.js"></script>
<script>
function hideMessage() {
document.getElementById("message").style.display = "none";
};
setTimeout(hideMessage, 5000);
</script>
</head>
<body >
<!--row starts here -->
<div class="row">
<div class="col-1-2">
</div>
<div class="col-1-2">
<div class="container">
<ul class="tabs">
<li class="tab-link current" data-tab="tab-1">Sign Up</li>
<li class="tab-link" data-tab="tab-2">Sign In</li>
</ul>
<div id="tab-1" class="tab-content current">
<div id="message"><?php if(isset($message)) echo $message; ?></div>
<ul id="registration-step">
<li id="account" class="highlight">Account</li>
<li id="password">Password</li>
<li id="general">Nick Name</li>
</ul>
<form name="frmRegistration" id="registration-form" method="post">
<div id="account-field">
<span id="email-error" class="registration-error"></span>
<div><input type="text" name="email" id="email" class="demoInputBox" placeholder="E-mail"/></div>
</div>
<div id="password-field" style="display:none;">
<span id="password-error" class="registration-error"></span>
<div><input type="password" name="password" id="user-password" class="demoInputBox" placeholder="Password"required /></div>
</div>
<div id="general-field" style="display:none;">
<div><input type="text" name="nickname" id="display-name" class="demoInputBox" placeholder="Nick Name"/></div>
</div>
<div>
<input class="btnAction" type="button" name="back" id="back" value="Back" style="display:none;">
<input class="btnAction" type="button" name="next" id="next" value="Next" >
<input class="btnAction" type="submit" name="finish" id="finish" value="Finish" style="display:none;">
</div>
</form>
</div>
<div id="tab-2" class="tab-content">
<div id="signinmsg"><?php if(isset($msg1)) echo $msg1; ?></div>
<form name="signin"method="post">
<input type="text" name="signinemail"class="demoInputBox"placeholder="E-mail">
<br><br>
<input type="text" class="demoInputBox"name="signinpass"placeholder="Password"><br><br>
<input class="btnAction" type="submit" name="go" id="go" value="Go.." >
</form>
</div>
</div>
</div>
<!--this row ends here -->
</body>
</html>
You should be checking if isset and not !empty
<?php
if (isset($_POST['finish'])) {
//do something here;
include'php/signup.php';
}
if (isset($_POST['go'])) {
include'php/signin.php';
}
?>
I have a website, where I uploaded an index.html which is completely made of HTML code (no PHP).
I copied this code over to an PHP file index.php, furthermore I separated the header into a separate php file. When I cleaned up the new index.php, I just used an include() to include the header, like so:
<? include("TopNote.php"); ?>
So the difference between index.html and index.php is that the HTML code is directly in the index.html and in the PHP file, it is included from a seperate PHP file.
Now the index.php file give a strange button, where the index.html displays it all the way I want it to display.
index.html:
<!doctype html>
<html lang="us">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="web/style.css">
<link href="css/smoothness/jquery-ui-1.10.3.custom.css" rel="stylesheet">
<style>
.ui-menu { position: absolute; width: 100px; }
</style>
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui-1.10.3.custom.js"></script>
<script>
$(function() {
$( "#menu" ).buttonset();
$( "#regdialog" ).dialog();
$( "#buttonregister" ).click(function() {
$( "#regdialog" ).dialog( "open" );
});
});
</script>
</head>
<body bgcolor="#aaaaaa">
<img src="example.lorg" alt="" style="padding-left:20px" />
<div align="right" style="padding-right:20px">
<div>
<button id="StaffLogin">Staff Login</button>
<button id="select">Select an action</button>
</div>
<ul>
<li>Log Out</li>
<li id="buttonregister">Register</li>
</ul>
</div>
<form style="margin-top: 1em;">
<div id="menu" align="center">
<input type="radio" id="buttonhome" name="radio" checked="checked"><label for="buttonhome">Home</label>
<input type="radio" id="buttonforums" name="radio"><label for="buttonforums">Forums</label>
<input type="radio" id="buttonapply" name="radio"><label for="buttonapply"><a class='fb_iframe' href="http://example.org">Apply</a></label>
<input type="radio" id="buttonabout" name="radio"><label for="buttonabout">About Us</label>
<input type="radio" id="select" name="radio">
</div>
</form>
<br />
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
<strong>Alert:</strong> The Site Is No Where Near Completed, Please go to our Forums
</p>
</div>
</div>
<!-- POP UP -->
<div id="regdialog" title="Register">
<form action="#" method="post">
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
Registrations are not working!
</p>
</div>
</div>
<h5>Username:</h5>
<input type="text" name="reg_name">
<h5>Password:</h5>
<input type="password" name="reg_pass">
<h5>Confirm Password:</h5>
<input type="password" name="reg_pass_conf">
<input type="submit">
</form>
</div>
</body>
</html>
index.php:
<!doctype html>
<html lang="us">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="web/style.css">
<link href="css/smoothness/jquery-ui-1.10.3.custom.css" rel="stylesheet">
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui-1.10.3.custom.js"></script>
</head>
<body bgcolor="#aaaaaa">
<? include("TopNote.php"); ?>
</body>
</html>
topnote.php
<!doctype html>
<html lang="us">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="web/style.css">
<link href="css/smoothness/jquery-ui-1.10.3.custom.css" rel="stylesheet">
<style>
.ui-menu { position: absolute; width: 100px; }
</style>
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui-1.10.3.custom.js"></script>
<script>
$(function() {
$( "#menu" ).buttonset();
$( "#regdialog" ).dialog();
$( "#buttonregister" ).click(function() {
$( "#regdialog" ).dialog( "open" );
});
});
</script>
</head>
<body bgcolor="#aaaaaa">
<img src="example.lorg" alt="" style="padding-left:20px" />
<div align="right" style="padding-right:20px">
<div>
<button id="StaffLogin">Staff Login</button>
<button id="select">Select an action</button>
</div>
<ul>
<li>Log Out</li>
<li id="buttonregister">Register</li>
</ul>
</div>
<form style="margin-top: 1em;">
<div id="menu" align="center">
<input type="radio" id="buttonhome" name="radio" checked="checked"><label for="buttonhome">Home</label>
<input type="radio" id="buttonforums" name="radio"><label for="buttonforums">Forums</label>
<input type="radio" id="buttonapply" name="radio"><label for="buttonapply"><a class='fb_iframe' href="http://example.org">Apply</a></label>
<input type="radio" id="buttonabout" name="radio"><label for="buttonabout">About Us</label>
<input type="radio" id="select" name="radio">
</div>
</form>
<br />
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
<strong>Alert:</strong> The Site Is No Where Near Completed, Please go to our Forums
</p>
</div>
</div>
<!-- POP UP -->
<div id="regdialog" title="Register">
<form action="#" method="post">
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
Registrations are not working!
</p>
</div>
</div>
<h5>Username:</h5>
<input type="text" name="reg_name">
<h5>Password:</h5>
<input type="password" name="reg_pass">
<h5>Confirm Password:</h5>
<input type="password" name="reg_pass_conf">
<input type="submit">
</form>
</div>
</body>
</html>
What is the difference, and how do i solve it?
You can not have a <html> tag inside a <body> tag. Your topnote.php does not need to have a doctype, head and all that stuff. Because index.php defines already html, doctype, head, title and so on.
So your topnote.php should only contain this elements:
<img src="http://destiny-craft.com/img/Logo_Resized.png" alt="" style="padding-left:20px" />
<div align="right" style="padding-right:20px">
<div>
<button id="StaffLogin">Staff Login</button>
<button id="select">Select an action</button>
</div>
<ul>
<li>Log Out</li>
<li id="buttonregister">Register</li>
</ul>
</div>
<form style="margin-top: 1em;">
<div id="menu" align="center">
<input type="radio" id="buttonhome" name="radio" checked="checked"><label for="buttonhome">Home</label>
<input type="radio" id="buttonforums" name="radio"><label for="buttonforums">Forums</label>
<input type="radio" id="buttonapply" name="radio"><label for="buttonapply"><a class='fb_iframe' href="http://destiny-craft.coffeecup.com/forms/ApplyForm/">Apply</a></label>
<input type="radio" id="buttonabout" name="radio"><label for="buttonabout">About Us</label>
<input type="radio" id="select" name="radio">
</div>
</form>
<br />
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
<strong>Alert:</strong> The Site Is No Where Near Completed, Please go to our Forums</p>
</div>
</div>
<!-- POP UP -->
<div id="regdialog" title="Register">
<form action="#" method="post">
<div class="ui-widget">
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
Registrations are not working!</p>
</div>
</div>
<h5>Username:</h5>
<input type="text" name="reg_name">
<h5>Password:</h5>
<input type="password" name="reg_pass">
<h5>Confirm Password:</h5>
<input type="password" name="reg_pass_conf">
<input type="submit">
</form>
</div>
And you can move your <script> tags which are in the <head> tag of your topnote.php to the end of topnote.php. It's valid and better practice to put them right before the closing </body> tag. That ensures that all DOM elements are loaded at this point.
topnote.php should not have doctype, html and head since you already added in the index.php
Avoid the Short Tag which will be XML complaint, use like below
<?php include 'file.php'?>