Hi. I am writing a simple (or at least I thought so) form to register data which then adds this data to a table in my database.
The basic form looks like this:
addrowgig.php:
What's funny is that I don't even get the echo-statement "Connected successfully" (and I know that the username/pw is correct, double-checked). It seems to be something else causing this. The row is not added either.
Another question I have, is the
Does this produce the correct mysql format for DATE "yyyy-mm-dd", og do I have to solve this different ?
Any thanks much appreciated!
The basic form looks like this:
Code:
<FORM name="Gig" method="post" action="addrowgig.php">
DATE <select name="day">
<option value="01">1<option value="02">2<option value="03">3<option value="04">4<option value="05">5
<option value="06">6<option value="07">7<option value="08">8<option value="09">9<option value="10">10
<option value="11">11<option value="12">12<option value="13">13<option value="14">14<option value="15">15
<option value="16">16<option value="17">17<option value="18">18<option value="19">19<option value="20">20
<option value="21">21<option value="22">22<option value="23">23<option value="24">24<option value="25">25
<option value="26">26<option value="27">27<option value="28">28<option value="29">29<option value="30">30
<option value="31">31</option></select>
<select name="month">
<option value="01">Jan<option value="02">Feb<option value="03">March
<option value="04">April<option value="05">May<option value="06">June
<option value="07">July<option value="08">August<option value="09">September
<option value="10">October<option value="11">November<option value="01">December</option></select>
<select name="year">
<option value="2005">2005<option value="2006">2006</option></select>
VENUE <input type="text" name="venue" size="10">
LOCATION <input type="text" name="location" size="30">
INFO <textarea name="info" cols="23" rows="5"></textarea>
<input type="submit" value="Send">
</FORM>
addrowgig.php:
Code:
<?php
// Connecting, selecting database
$link = mysql_connect('localhost', 'username', 'password')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('secondshadow_ne') or die('Could not select database');
@extract($_POST);
$day = stripslashes($day);
$month = stripslashes($month);
$year = stripslashes($year);
$venue = stripslashes($venue);
$location = stripslashes($location);
$info = stripslashes($info);
$price = stripslashes($price);
$query = "INSERT INTO `web_gigs` (`gigDate`, `gigVenue`, `gigLocation`, `gigInfo`)
VALUES ('$year-$month-$day', '$venue', '$location', '$info')";
mysql_query($query) or die('Query failed: ' . mysql_error());
mysql_close($link);
?>
What's funny is that I don't even get the echo-statement "Connected successfully" (and I know that the username/pw is correct, double-checked). It seems to be something else causing this. The row is not added either.
Another question I have, is the
Code:
VALUES ('$year-$month-$day')
Any thanks much appreciated!
Last edited:








