/    Sign up×
Community /Pin to ProfileBookmark

how to add upload image to sql to my add event script

Hi guys,

I’ve never tried adding an upload image part to my script before, but need to add this to my add new events page – for my admins to upload jpg images to sql –

where do I start…..

obviously add new form field for the upload form below – and what about the type of multi-part or type of form ??

any help appreciated!

thanks…..see below for script as it is now.


——————————

<?php if (isset($_POST[‘party_title’])):

// new party has been added using the form below

$Link = @mysql_connect(‘cust-mysql-123-01’, ‘upartyc_495097_1’, ‘partYweb1979’);
if (!$Link) {
exit(‘<p>Unable to connect to the ‘ .
‘database server at this time.</p>’);
}

if (!@mysql_select_db(‘partycoorg_495097_db1’)) {
exit(‘<p>Unable to locate the PartyCo ‘ .
‘database at this time.</p>’);
}

$party_title = $_POST[‘party_title’];
$description = $_
POST[‘description’];
$price = $_POST[‘price’];
$size = $_
POST[‘size’];
$venue = $_POST[‘venue’];
$includes = $_
POST[‘includes’];
$dates_prices = $_POST[‘dates_prices’];
$times = $_
POST[‘times’];
$venue_info = $_POST[‘venue_info’];
$menu = $_
POST[‘menu’];
$location = $_POST[‘location’];
$sql = “INSERT INTO christmas SET
party_title=’$party_title’,
description=’$description’,
price=’$price’,
size=’$size’,
venue=’$venue’,
includes=’$includes’,
dates_prices=’$dates_prices’,
times=’$times’,
venue_info=’$venue_info’,
menu=’$menu’,
location=’$location'”;
if (@mysql_query($sql)) {
echo ‘<p>A new Christmas Party has been added.</p>’;
} else {
echo ‘<p>Error updating details: ‘ .
mysql_error() . ‘</p>’;
}

?>

<p><a href=”<?php echo $_SERVER[‘PHP_SELF’]; ?>”>Add another Party?</a></p>
<p><a href=”christmas.php”>Return to Christmas Parties List</a></p>

<?php else:

?>

<h3 style=”margin:10px 0;”>Please enter your new party</h3>

<p style=”margin:10px 0; color:#c70000;”>Type <b>&ltbr&gt;</b> to start a new line of text when adding information, and add another one to start a new paragraph.</p>

<form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”post”>
<table cellspacing=”3″ cellpadding=”0″ border=”0″ style=”margin:10px 0 0 0;”>
<tr><td class=”formHeader”>Party Name:</td><td><input type=”text” class=”manageFormBox” name=”party_title” /></td></tr>
<tr><td class=”formHeader”>Party Description:</td><td><textarea cols=”50″ rows=”8″ name=”description”></textarea> </td></tr>

<tr><td colspan=”2″><p style=”margin:10px 0; color:#c70000;”><b>Price Tip:</b> Do Enter like this <b>55</b> – dont enter like this <b>55.00</b> – unless actual pence is given.</p></td></tr>

<tr><td class=”formHeader”>Price:</td><td><input type=”text”class=”manageFormBox” name=”price” /></td></tr>
<tr><td class=”formHeader”>Size:</td><td><input type=”text” class=”manageFormBox” name=”size” /></td></tr>

<tr><td class=”formHeader”>Venue Name:</td><td><input type=”text” class=”manageFormBox” cols=”39″ rows=”8″ name=”venue” /></td></td></tr>
<tr><td class=”formHeader”>Includes:</td><td><textarea cols=”50″ rows=”8″ name=”includes”></textarea></td></tr>
<tr><td class=”formHeader”>dates &amp; prices:</td><td><textarea cols=”50″ rows=”8″ name=”dates_prices”></textarea></td></tr>
<tr><td class=”formHeader”>times:</td><td><textarea name=”times” cols=”50″ rows=”8″></textarea></td></tr>
<tr><td class=”formHeader”>venue info:</td><td><textarea cols=”50″ rows=”8″ name=”venue_info”></textarea></td></tr>
<tr><td class=”formHeader”>menu:</td><td><textarea cols=”50″ rows=”8″ name=”menu”></textarea></td></tr>

<tr>
<td class=”formHeader”>Location</td>

<td style=”color:#333333; font-size:9pt; font-weight:bold;”>
<table width=”100%” border=”0″>
<tr>
<td><input name=”location” type=”checkbox” value=”London-Shared” id=”txtEmailOptIn” />London Shared</td>
<td><input name=”location” type=”checkbox” value=”London-Exclusive” id=”txtEmailOptIn” />London Exclusive</td></tr>

<tr>
<td><input name=”location” type=”checkbox” value=”Midlands” id=”txtEmailOptIn” />Midlands</td>
<td><input name=”location” type=”checkbox” value=”North” id=”txtEmailOptIn” />North</td>
</tr>

<tr><td><input name=”location” type=”checkbox” value=”Scotland” id=”txtEmailOptIn” />Scotland</td>
<td><input name=”location” type=”checkbox” value=”South” id=”txtEmailOptIn” />South</td></tr>

<tr><td><input name=”location” type=”checkbox” value=”SouthWest” id=”txtEmailOptIn” />South West</td></tr>
</table>

</td>
</tr>

<tr><td align=”right” colspan=”2″><input type=”submit” value=”update event” /></td></tr>
</table>
</form>

<?php endif; ?>

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@tirnaJul 08.2010 — This w3schools tute on uploading images should be able to show you what you need.
×

Success!

Help @aarondm spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...