Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

All Text boxes post to database except this one plz help

Featured Replies

Ok guys please help, all the other boxes post to the database except $proddesc:

 

saveproduct.php

<?php
include("db.php");
$servicecentre=$_POST['servicecentre'];
$ponumber=$_POST['ponumber'];
$prodcode=$_POST['productcode'];
$proddesc=$_POST['productdescription'];
$price=$_POST['price'];
$qty=$_POST['quantity'];
$total=$_POST['total'];
mysql_query("INSERT INTO purchaseorder (servicecentre,ponumber,productcode,productdescription,price,quantity,total) VALUES ('$servicecentre','$ponumber','$prodcode','$proddesc','$price','$qty','$total')");
header("location: tableedit.php#page=addpro");
?>

 

and the HTML:

<div class="content" id="addpro">
<form style="text-align:right"action="saveproduct.php" method="post">
	<div style="width:400px; text-align:right">
    <div style="margin-left: 48px;">
	Service Centre: <input name="servicecentre" type="text" />
	</div>
	<br />
	<div style="margin-left: 97px;">
	PO Number: <input name="ponumber" type="text" />
	</div>
	<br />
	<div style="margin-left: 80px;">
	Product Code: <input name="productcode" type="text" />
	</div>
    <br />
	<div style="margin-left: 80px;">
	Product Description:  <input name="proddesc" type="text" />
	</div>
    <br />
	<div style="margin-left: 80px;">
	Price:  £<input name="price" type="text" />
	</div>
    <br />
	<div style="margin-left: 80px;">
	Quantity: <input name="quantity" type="text" />
	</div>
    <br />
	<div style="margin-left: 80px;">
	Total: £<input name="total" type="text" />
	</div>
	<div style="margin-left: 127px; margin-top: 14px;"><input name="" type="submit" value="Add" /></div>
</div>
</form>
</div>

 

 

Thanks In advanced

 

:)

  • Author

$proddesc=$_POST['productdescription']; to $proddesc=$_POST['proddesc']; the names in the inpute didnt match!

 

Thank you so much for your quick reply it was driving me nuts, the only thing i have to ask is i thought where $_POST['proddesc] is i thought had to be the database column that i wanted to post to, sorry but im new to php, HTML and CSS is my specialty

haha no worries, i wasn't going to make big DEAL out of it, as i do it all the time...

You might want to think about securing the results, as the way it is coded it is open to hacking, someone can actually extract all your data the way you have it.

Have a look a little read of this http://php.net/manual/en/function.mysql-real-escape-string.php or lookup SQL Injection in google.

Edited by inlinedivblock

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.