im using the coding i used for a different project but with a little tweek here and there but it doesnt seem to work. as in the textboxes are empty, like the data isnt in there.
<?php
if($sql) {
$eventname = htmlentities($rw['event_name']);
$startdate = htmlentities($rw['start_date']);
// and so on for all your other columns
}
else {
$eventname = '';
$startdate = '';
// and so on for all your other columns
}
?>
<form name="create" method="post" action="event.php">
<fieldset>
<legend>Create an Event</legend>
Event Name: <input type="text" name="ename" value="<?php echo $eventname; ?>" required/>
<p id="date">
Event Start : <input type="text" name="datestart" class="date start" size="10" value="<?php echo startdate; ?>" required/><input type="text" id="date-start" name="timestart" class="time start" size="10" value="<?php if($sql){echo htmlentities ($rw['start_time']);}?>" required/>
</p>
<p id="date">
Event End : <input type="text" name="dateend" class="date end" size="10" value="<?php if($sql){echo htmlentities ($rw['end_date']);}?>" required/><input type="text" id="date-start" name="timeend" class="time end" size="10" value="<?php if($sql){echo htmlentities ($rw['end_time']);}?>" required/>
</p>
Event Venue: <input type="text" name="evenue" value="<?php if($sql){echo htmlentities ($rw['event_venue']);}?>" required/><br/>
<input type="submit" name="submit" value="Create Event" /><input type="submit" id="cancel" name="cancel" value="Cancel" />
</fieldset>
I haven’t edited all the code, but to me it’s much nicer to do the check outside the html, set a variable for each form attribute, then use those within the form. Much easier to handle what you might want to use for start dates for example if you’re not trying to shoe-horn it all into the form itself. My opinion only, of course.
I’m a bit confused as to what the page does. The title suggests you’re creating an event (to me, that means a new event), so why would any of the data already be there? If you’re editing an existing event, and you’ve got to the form stage by selecting the data based on the id from a previous page, would you want to display the form, or deal with the fact that an id that was in the previous page for the user to select is now missing? Anyway, that’s off the question.
droopsnoot i did try ur way and it didn’t work either i got the same warning and i m still getting the same warning:
<br /><b>Notice</b>: Undefined variable: z in <b>D:\Xampp\htdocs\EMS2\event.php</b> on line <b>298</b><br />
well of course when i did ur way it said Undefined variable for $eventname etc…
so i changed it a bit. not so much just the html structure:
Error message implies that your query is returning nothing and therefore mysql_fetch_array() does not create the array. Is the value of $edit_id what you would expect it to be when you echo it?
ETA: My point about creating separate variables before you start displaying the form was about your note saying that you suppress error messages so that they don’t appear in your text boxes. By controlling that away from the textbox contents you don’t have to try to deal with it in inline code.