PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
It is currently Sun Mar 18, 2018 8:13 pm

All times are UTC - 5 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Jun 14, 2017 12:15 pm 
Forum Newbie

Joined: Wed Jun 14, 2017 12:07 pm
Posts: 1
I am trying to push the data from this simple html grid into mysql but I can't do it. in the beginning, I got the error that there was no index for the var impressions. I fixed that. when I use just the advertiser value I can push the data into mysql while with the second value, I can't succeed. can you explain me what I am doing wrong? here you can find my html code and as well the query i used to create the db. sorry if the questions is dumb, just a beginner


include_once 'con_ui.php';

$advertiser = $_POST["advertiser"];
$impressions = (isset($POST["impressions"])?

$sql_query = "INSERT INTO data(adv, imp) VALUES('$advertiser', '$impressions')";

// sql query for inserting data into database


<form method="post">
<table id="myTable" align='center' cellspacing=0 cellpadding=5 border=1>


<select name="advertiser" id="advertiser">
<option value="">Select advertiser</option>
<option value = "Brita ">Brita</option>
<option value = "Sammontana">Sammontana</option>


<td name= "impressions" id="impressions" >1000000</td>

<button type="submit" name="btn-save"><strong>SAVE</strong></button>
creating db here:
CREATE TABLE `shaa`.`data` (
`adv` VARCHAR( 25 ) NOT NULL ,
`imp` INT( 10 ) NOT NULL

) ENGINE = InnoDB;

PostPosted: Sun Nov 12, 2017 1:30 am 
Forum Newbie

Joined: Sun Nov 15, 2015 12:57 pm
Posts: 16
Hopefully you have learned what you need to know by now.

For others running across this post, the OP has pretty much done everything you could possibly do wrong in this code. Problems include using dangerous, obsolete mysql code that has been completely removed from PHP, depending in the name of a button for the script to work instead of checking the REQUEST METHOD, creating variables for nothing, not using prepared statements, putting variables in the query, missing closing table tag, giving a name to a TD tag and expecting it to work like an input tag and submit a value, using a table for non-tabular layout instead of CSS, using deprecated HTML...........

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours

Who is online

Users browsing this forum: No registered users and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group