Jump to content

running mysql query in php


sofia403

Recommended Posts

Hi i was wondering what im doing wrong, im trying to insert a query for submit button, it works if i run it straight in mysql, but not working when linked through php. Im just doing it for testing purpose right now only, so when i see that it works i will use another query.

 

here it is

 

<?php 
include('config.php');
if($_SESSION['username']){
if(isset($_POST['ASubmit'])){
$query3=("update country set Status='test1' where Uname='Mclovin'");}

echo '<td><form name="test" method="post" form id="form1"><label for="test">Status</label>
	<select name="Status">
	<option value="">-----</option>
	<option value="In process" '.(($row['Status']=='In process')?'selected="selected"':'').'>In process</option>
	<option value="Approved" '.(($row['Status']=='Approved')?'selected="selected"':'').'>Approved</option>
	<option value="Denied" '.(($row['Status']=='Denied')?'selected="selected"':'').'>Denied</option>
        </select><input name="ASubmit" type="submit" value="Update">'; echo $row{'Status'}.'</td></form>';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/
Share on other sites

Looks like you are also missing the action=\"processingpage.php\" on your form.  If Just checking things out on the same page you can use the # sign.

<form name=\"test\" method=\"post\" form id=\"form1\" action=\"#\" />

 

You also have nesting issue by placing </form> tag outside </td>.

what is processingpage.php? i dont have that at all.
Read... what is the form supposed to do or where is it being processed.  The action directs the form to the page where it is being processed.  I said, you can use the # if being processed on the same page or you can put the actual page name in there.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.