variable passing

0 reema dawes · September 11, 2014
<form action="page2.php" method="post">
title <input type="text" name="title" >
content <input type="text" name="content">
homepage <input type="checkbox" name="chk" value="yes">
<input type="submit" name="submit" value="submit">
<?php
if (isset($_POST['submit']))
$title= $_POST['title'];
$content=$_POST ['content'];
$chk=$_POST['chk'];
if ( $title=='' or $content==''){
echo"enter all fields";
}
else {
$query=INSERT into posts VALUE ('',$title,'$content,'')
}
if ($query_run=mysql_query($query) {
echo "successful";
}

if (isset($_POST['chk'])&& $chk=='yes'))
while ($row=mysql_fetch_assoc($query_run)){
echo "<a href=\"index.php?id=".$row['id']."/> </a>";
}





?>

Post a Reply

Replies

- page 2
Oldest  Newest  Rating
+1 Franz Schmidt · September 12, 2014
And whats your problem?
0 reema dawes · September 12, 2014
i am trying to get the specific data of the column id from the database if the checkbox is clicked, so the information should pass to index.php otherwise it just inserts into the database.
+1 Franz Schmidt · September 11, 2014
What is with this code?
  • 1
  • 2

PHP

129,699 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators