homepage Welcome to WebmasterWorld Guest from 23.20.43.165
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
if empty do.esle,.does not work, canīt see reason
helenp




msg:4521932
 5:04 pm on Nov 23, 2012 (gmt 0)

Hi,
Been all day looking at this code, think im going crazy as it looks correct to me, must me somengthing so stupid that I canīt see it.

I have one page with a form where one choose between two values in radiobuttons, if one click on the sendbutton without checking any of the buttons, a javascript function is ejectuded telling to choose one of them.
first the javescript then this code comes:
<?php
$propiedad = @mysql_real_escape_string($_POST['propiedad']);
$bookingway = @mysql_real_escape_string($_POST['bookingway']);
$instant = @mysql_real_escape_string($_POST['instant']);
$enquirer = @mysql_real_escape_string($_POST['enquirer']);
?>
<div class="bookingway">
<form action="bookingways.php" method="post" name="bookingways" id="bookingways" onSubmit="return validate_form2 ( );">
<input type="text" name="propiedad" value="<?php print $propiedad;?>">
<p class="bookingway">
<input name="bookingway" type="radio" value="instant">Instant booking (I have read terms and conditions).<br>
<input name="bookingway" type="radio" value="enquirer">Send enquirer or book by email.
</p>
<p align="center"><input class="boton" type="submit" name="enviar" value="Send"> </p>
</form>
</div>


When I choose one and click on the submitbutton I am taking to a controlpage wich checks in php if one of the buttons where checked, if none are checked one should be told in php to check one of them, but if one of them were checked one should be redirected to another page depending on button choosen, however it does not work. I chek one of the buttons and get the errormessage saying me to please choose one of them...
This is the code on that page:
<?php
$propiedad = @mysql_real_escape_string($_POST['propiedad']);
$bookingway = @mysql_real_escape_string($_POST['bookingway']);
$instant = @mysql_real_escape_string($_POST['instant']);
$enquirer = @mysql_real_escape_string($_POST['enquirer']);
if ($_POST['enviar']) {
if (empty($bookingway)) {
echo "Please choose instant booking or send enquirer";
}
else{
if ($bookingway=="instant"){
header ("Location: bookingform.php");
}
if ($bookingway=="enquirer"){
header ("Location: bookingform.php");
}
}//else
}//if enviar

?>


Any help please,
thanks

 

helenp




msg:4522187
 1:41 pm on Nov 24, 2012 (gmt 0)

Lol, it was do to not taking away the mysql call, as I always use those as normally I always work with mysql, it works now.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved